aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/bmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r--fs/gfs2/bmap.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index dab54099dd98..49cd7dd4a9fa 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -785,6 +785,9 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
785 if (error) 785 if (error)
786 goto out_rlist; 786 goto out_rlist;
787 787
788 if (gfs2_rs_active(ip->i_res)) /* needs to be done with the rgrp glock held */
789 gfs2_rs_deltree(ip->i_res);
790
788 error = gfs2_trans_begin(sdp, rg_blocks + RES_DINODE + 791 error = gfs2_trans_begin(sdp, rg_blocks + RES_DINODE +
789 RES_INDIRECT + RES_STATFS + RES_QUOTA, 792 RES_INDIRECT + RES_STATFS + RES_QUOTA,
790 revokes); 793 revokes);
@@ -1045,12 +1048,13 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size)
1045 lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift; 1048 lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift;
1046 1049
1047 find_metapath(sdp, lblock, &mp, ip->i_height); 1050 find_metapath(sdp, lblock, &mp, ip->i_height);
1048 if (!gfs2_qadata_get(ip)) 1051 error = gfs2_rindex_update(sdp);
1049 return -ENOMEM; 1052 if (error)
1053 return error;
1050 1054
1051 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 1055 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
1052 if (error) 1056 if (error)
1053 goto out; 1057 return error;
1054 1058
1055 while (height--) { 1059 while (height--) {
1056 struct strip_mine sm; 1060 struct strip_mine sm;
@@ -1064,8 +1068,6 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size)
1064 1068
1065 gfs2_quota_unhold(ip); 1069 gfs2_quota_unhold(ip);
1066 1070
1067out:
1068 gfs2_qadata_put(ip);
1069 return error; 1071 return error;
1070} 1072}
1071 1073
@@ -1167,19 +1169,14 @@ static int do_grow(struct inode *inode, u64 size)
1167 struct gfs2_inode *ip = GFS2_I(inode); 1169 struct gfs2_inode *ip = GFS2_I(inode);
1168 struct gfs2_sbd *sdp = GFS2_SB(inode); 1170 struct gfs2_sbd *sdp = GFS2_SB(inode);
1169 struct buffer_head *dibh; 1171 struct buffer_head *dibh;
1170 struct gfs2_qadata *qa = NULL;
1171 int error; 1172 int error;
1172 int unstuff = 0; 1173 int unstuff = 0;
1173 1174
1174 if (gfs2_is_stuffed(ip) && 1175 if (gfs2_is_stuffed(ip) &&
1175 (size > (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)))) { 1176 (size > (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)))) {
1176 qa = gfs2_qadata_get(ip);
1177 if (qa == NULL)
1178 return -ENOMEM;
1179
1180 error = gfs2_quota_lock_check(ip); 1177 error = gfs2_quota_lock_check(ip);
1181 if (error) 1178 if (error)
1182 goto do_grow_alloc_put; 1179 return error;
1183 1180
1184 error = gfs2_inplace_reserve(ip, 1); 1181 error = gfs2_inplace_reserve(ip, 1);
1185 if (error) 1182 if (error)
@@ -1214,8 +1211,6 @@ do_grow_release:
1214 gfs2_inplace_release(ip); 1211 gfs2_inplace_release(ip);
1215do_grow_qunlock: 1212do_grow_qunlock:
1216 gfs2_quota_unlock(ip); 1213 gfs2_quota_unlock(ip);
1217do_grow_alloc_put:
1218 gfs2_qadata_put(ip);
1219 } 1214 }
1220 return error; 1215 return error;
1221} 1216}