diff options
Diffstat (limited to 'fs/gfs2/ops_inode.c')
| -rw-r--r-- | fs/gfs2/ops_inode.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index d85f6e05cb95..911c115b5c6c 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
| @@ -157,7 +157,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
| 157 | if (error) | 157 | if (error) |
| 158 | goto out_gunlock; | 158 | goto out_gunlock; |
| 159 | 159 | ||
| 160 | error = gfs2_dir_search(dir, &dentry->d_name, NULL, NULL); | 160 | error = gfs2_dir_check(dir, &dentry->d_name, NULL); |
| 161 | switch (error) { | 161 | switch (error) { |
| 162 | case -ENOENT: | 162 | case -ENOENT: |
| 163 | break; | 163 | break; |
| @@ -206,7 +206,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
| 206 | goto out_gunlock_q; | 206 | goto out_gunlock_q; |
| 207 | 207 | ||
| 208 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + | 208 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + |
| 209 | al->al_rgd->rd_ri.ri_length + | 209 | al->al_rgd->rd_length + |
| 210 | 2 * RES_DINODE + RES_STATFS + | 210 | 2 * RES_DINODE + RES_STATFS + |
| 211 | RES_QUOTA, 0); | 211 | RES_QUOTA, 0); |
| 212 | if (error) | 212 | if (error) |
| @@ -217,8 +217,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
| 217 | goto out_ipres; | 217 | goto out_ipres; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | error = gfs2_dir_add(dir, &dentry->d_name, &ip->i_num, | 220 | error = gfs2_dir_add(dir, &dentry->d_name, ip, IF2DT(inode->i_mode)); |
| 221 | IF2DT(inode->i_mode)); | ||
| 222 | if (error) | 221 | if (error) |
| 223 | goto out_end_trans; | 222 | goto out_end_trans; |
| 224 | 223 | ||
| @@ -275,7 +274,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) | |||
| 275 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 274 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
| 276 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 275 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); |
| 277 | 276 | ||
| 278 | rgd = gfs2_blk2rgrpd(sdp, ip->i_num.no_addr); | 277 | rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); |
| 279 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); | 278 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); |
| 280 | 279 | ||
| 281 | 280 | ||
| @@ -420,7 +419,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
| 420 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); | 419 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); |
| 421 | gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); | 420 | gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); |
| 422 | 421 | ||
| 423 | gfs2_inum_out(&dip->i_num, &dent->de_inum); | 422 | gfs2_inum_out(dip, dent); |
| 424 | dent->de_type = cpu_to_be16(DT_DIR); | 423 | dent->de_type = cpu_to_be16(DT_DIR); |
| 425 | 424 | ||
| 426 | gfs2_dinode_out(ip, di); | 425 | gfs2_dinode_out(ip, di); |
| @@ -472,7 +471,7 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 472 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 471 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
| 473 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 472 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); |
| 474 | 473 | ||
| 475 | rgd = gfs2_blk2rgrpd(sdp, ip->i_num.no_addr); | 474 | rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); |
| 476 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); | 475 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); |
| 477 | 476 | ||
| 478 | error = gfs2_glock_nq_m(3, ghs); | 477 | error = gfs2_glock_nq_m(3, ghs); |
| @@ -614,7 +613,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 614 | * this is the case of the target file already existing | 613 | * this is the case of the target file already existing |
| 615 | * so we unlink before doing the rename | 614 | * so we unlink before doing the rename |
| 616 | */ | 615 | */ |
| 617 | nrgd = gfs2_blk2rgrpd(sdp, nip->i_num.no_addr); | 616 | nrgd = gfs2_blk2rgrpd(sdp, nip->i_no_addr); |
| 618 | if (nrgd) | 617 | if (nrgd) |
| 619 | gfs2_holder_init(nrgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh++); | 618 | gfs2_holder_init(nrgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh++); |
| 620 | } | 619 | } |
| @@ -653,7 +652,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 653 | if (error) | 652 | if (error) |
| 654 | goto out_gunlock; | 653 | goto out_gunlock; |
| 655 | 654 | ||
| 656 | error = gfs2_dir_search(ndir, &ndentry->d_name, NULL, NULL); | 655 | error = gfs2_dir_check(ndir, &ndentry->d_name, NULL); |
| 657 | switch (error) { | 656 | switch (error) { |
| 658 | case -ENOENT: | 657 | case -ENOENT: |
| 659 | error = 0; | 658 | error = 0; |
| @@ -712,7 +711,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 712 | goto out_gunlock_q; | 711 | goto out_gunlock_q; |
| 713 | 712 | ||
| 714 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + | 713 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + |
| 715 | al->al_rgd->rd_ri.ri_length + | 714 | al->al_rgd->rd_length + |
| 716 | 4 * RES_DINODE + 4 * RES_LEAF + | 715 | 4 * RES_DINODE + 4 * RES_LEAF + |
| 717 | RES_STATFS + RES_QUOTA + 4, 0); | 716 | RES_STATFS + RES_QUOTA + 4, 0); |
| 718 | if (error) | 717 | if (error) |
| @@ -750,7 +749,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 750 | if (error) | 749 | if (error) |
| 751 | goto out_end_trans; | 750 | goto out_end_trans; |
| 752 | 751 | ||
| 753 | error = gfs2_dir_mvino(ip, &name, &ndip->i_num, DT_DIR); | 752 | error = gfs2_dir_mvino(ip, &name, ndip, DT_DIR); |
| 754 | if (error) | 753 | if (error) |
| 755 | goto out_end_trans; | 754 | goto out_end_trans; |
| 756 | } else { | 755 | } else { |
| @@ -758,7 +757,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 758 | error = gfs2_meta_inode_buffer(ip, &dibh); | 757 | error = gfs2_meta_inode_buffer(ip, &dibh); |
| 759 | if (error) | 758 | if (error) |
| 760 | goto out_end_trans; | 759 | goto out_end_trans; |
| 761 | ip->i_inode.i_ctime = CURRENT_TIME_SEC; | 760 | ip->i_inode.i_ctime = CURRENT_TIME; |
| 762 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 761 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
| 763 | gfs2_dinode_out(ip, dibh->b_data); | 762 | gfs2_dinode_out(ip, dibh->b_data); |
| 764 | brelse(dibh); | 763 | brelse(dibh); |
| @@ -768,8 +767,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 768 | if (error) | 767 | if (error) |
| 769 | goto out_end_trans; | 768 | goto out_end_trans; |
| 770 | 769 | ||
| 771 | error = gfs2_dir_add(ndir, &ndentry->d_name, &ip->i_num, | 770 | error = gfs2_dir_add(ndir, &ndentry->d_name, ip, IF2DT(ip->i_inode.i_mode)); |
| 772 | IF2DT(ip->i_inode.i_mode)); | ||
| 773 | if (error) | 771 | if (error) |
| 774 | goto out_end_trans; | 772 | goto out_end_trans; |
| 775 | 773 | ||
| @@ -905,8 +903,8 @@ static int setattr_size(struct inode *inode, struct iattr *attr) | |||
| 905 | } | 903 | } |
| 906 | 904 | ||
| 907 | error = gfs2_truncatei(ip, attr->ia_size); | 905 | error = gfs2_truncatei(ip, attr->ia_size); |
| 908 | if (error) | 906 | if (error && (inode->i_size != ip->i_di.di_size)) |
| 909 | return error; | 907 | i_size_write(inode, ip->i_di.di_size); |
| 910 | 908 | ||
| 911 | return error; | 909 | return error; |
| 912 | } | 910 | } |
