diff options
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 4ce22e547308..381893ceefa4 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -712,14 +712,9 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
712 | if (error) | 712 | if (error) |
713 | goto fail_gunlock2; | 713 | goto fail_gunlock2; |
714 | 714 | ||
715 | /* The newly created inode needs a reservation so it can allocate | 715 | error = gfs2_rs_alloc(ip); |
716 | xattrs. At the same time, we want new blocks allocated to the new | 716 | if (error) |
717 | dinode to be as contiguous as possible. Since we allocated the | 717 | goto fail_gunlock2; |
718 | dinode block under the directory's reservation, we transfer | ||
719 | ownership of that reservation to the new inode. The directory | ||
720 | doesn't need a reservation unless it needs a new allocation. */ | ||
721 | ip->i_res = dip->i_res; | ||
722 | dip->i_res = NULL; | ||
723 | 718 | ||
724 | error = gfs2_acl_create(dip, inode); | 719 | error = gfs2_acl_create(dip, inode); |
725 | if (error) | 720 | if (error) |
@@ -737,10 +732,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
737 | brelse(bh); | 732 | brelse(bh); |
738 | 733 | ||
739 | gfs2_trans_end(sdp); | 734 | gfs2_trans_end(sdp); |
740 | /* Check if we reserved space in the rgrp. Function link_dinode may | 735 | gfs2_inplace_release(dip); |
741 | not, depending on whether alloc is required. */ | ||
742 | if (gfs2_mb_reserved(dip)) | ||
743 | gfs2_inplace_release(dip); | ||
744 | gfs2_quota_unlock(dip); | 736 | gfs2_quota_unlock(dip); |
745 | mark_inode_dirty(inode); | 737 | mark_inode_dirty(inode); |
746 | gfs2_glock_dq_uninit_m(2, ghs); | 738 | gfs2_glock_dq_uninit_m(2, ghs); |
@@ -897,7 +889,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
897 | goto out_gunlock_q; | 889 | goto out_gunlock_q; |
898 | 890 | ||
899 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + | 891 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + |
900 | gfs2_rg_blocks(dip) + | 892 | gfs2_rg_blocks(dip, sdp->sd_max_dirres) + |
901 | 2 * RES_DINODE + RES_STATFS + | 893 | 2 * RES_DINODE + RES_STATFS + |
902 | RES_QUOTA, 0); | 894 | RES_QUOTA, 0); |
903 | if (error) | 895 | if (error) |
@@ -1378,7 +1370,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
1378 | goto out_gunlock_q; | 1370 | goto out_gunlock_q; |
1379 | 1371 | ||
1380 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + | 1372 | error = gfs2_trans_begin(sdp, sdp->sd_max_dirres + |
1381 | gfs2_rg_blocks(ndip) + | 1373 | gfs2_rg_blocks(ndip, sdp->sd_max_dirres) + |
1382 | 4 * RES_DINODE + 4 * RES_LEAF + | 1374 | 4 * RES_DINODE + 4 * RES_LEAF + |
1383 | RES_STATFS + RES_QUOTA + 4, 0); | 1375 | RES_STATFS + RES_QUOTA + 4, 0); |
1384 | if (error) | 1376 | if (error) |
@@ -1722,7 +1714,9 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name, | |||
1722 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 1714 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
1723 | ret = gfs2_glock_nq(&gh); | 1715 | ret = gfs2_glock_nq(&gh); |
1724 | if (ret == 0) { | 1716 | if (ret == 0) { |
1725 | ret = generic_setxattr(dentry, name, data, size, flags); | 1717 | ret = gfs2_rs_alloc(ip); |
1718 | if (ret == 0) | ||
1719 | ret = generic_setxattr(dentry, name, data, size, flags); | ||
1726 | gfs2_glock_dq(&gh); | 1720 | gfs2_glock_dq(&gh); |
1727 | } | 1721 | } |
1728 | gfs2_holder_uninit(&gh); | 1722 | gfs2_holder_uninit(&gh); |
@@ -1757,7 +1751,9 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name) | |||
1757 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 1751 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
1758 | ret = gfs2_glock_nq(&gh); | 1752 | ret = gfs2_glock_nq(&gh); |
1759 | if (ret == 0) { | 1753 | if (ret == 0) { |
1760 | ret = generic_removexattr(dentry, name); | 1754 | ret = gfs2_rs_alloc(ip); |
1755 | if (ret == 0) | ||
1756 | ret = generic_removexattr(dentry, name); | ||
1761 | gfs2_glock_dq(&gh); | 1757 | gfs2_glock_dq(&gh); |
1762 | } | 1758 | } |
1763 | gfs2_holder_uninit(&gh); | 1759 | gfs2_holder_uninit(&gh); |