summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/bmap.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2012-05-18 09:28:23 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-06-06 06:20:22 -0400
commit5407e24229408d7586ee451a384fc13e4a2332be (patch)
tree7534b0d0fc69de50b6156ec4e384a71acf01dea1 /fs/gfs2/bmap.c
parent0a305e496059a113f93bdd3ad27a5aaa917fe34d (diff)
GFS2: Fold quota data into the reservations struct
This patch moves the ancillary quota data structures into the block reservations structure. This saves GFS2 some time and effort in allocating and deallocating the qadata structure. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r--fs/gfs2/bmap.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index dab54099dd98..6d957a86482b 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1045,12 +1045,13 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size)
1045 lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift; 1045 lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift;
1046 1046
1047 find_metapath(sdp, lblock, &mp, ip->i_height); 1047 find_metapath(sdp, lblock, &mp, ip->i_height);
1048 if (!gfs2_qadata_get(ip)) 1048 error = gfs2_rindex_update(sdp);
1049 return -ENOMEM; 1049 if (error)
1050 return error;
1050 1051
1051 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 1052 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
1052 if (error) 1053 if (error)
1053 goto out; 1054 return error;
1054 1055
1055 while (height--) { 1056 while (height--) {
1056 struct strip_mine sm; 1057 struct strip_mine sm;
@@ -1064,8 +1065,6 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size)
1064 1065
1065 gfs2_quota_unhold(ip); 1066 gfs2_quota_unhold(ip);
1066 1067
1067out:
1068 gfs2_qadata_put(ip);
1069 return error; 1068 return error;
1070} 1069}
1071 1070
@@ -1167,19 +1166,14 @@ static int do_grow(struct inode *inode, u64 size)
1167 struct gfs2_inode *ip = GFS2_I(inode); 1166 struct gfs2_inode *ip = GFS2_I(inode);
1168 struct gfs2_sbd *sdp = GFS2_SB(inode); 1167 struct gfs2_sbd *sdp = GFS2_SB(inode);
1169 struct buffer_head *dibh; 1168 struct buffer_head *dibh;
1170 struct gfs2_qadata *qa = NULL;
1171 int error; 1169 int error;
1172 int unstuff = 0; 1170 int unstuff = 0;
1173 1171
1174 if (gfs2_is_stuffed(ip) && 1172 if (gfs2_is_stuffed(ip) &&
1175 (size > (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)))) { 1173 (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); 1174 error = gfs2_quota_lock_check(ip);
1181 if (error) 1175 if (error)
1182 goto do_grow_alloc_put; 1176 return error;
1183 1177
1184 error = gfs2_inplace_reserve(ip, 1); 1178 error = gfs2_inplace_reserve(ip, 1);
1185 if (error) 1179 if (error)
@@ -1214,8 +1208,6 @@ do_grow_release:
1214 gfs2_inplace_release(ip); 1208 gfs2_inplace_release(ip);
1215do_grow_qunlock: 1209do_grow_qunlock:
1216 gfs2_quota_unlock(ip); 1210 gfs2_quota_unlock(ip);
1217do_grow_alloc_put:
1218 gfs2_qadata_put(ip);
1219 } 1211 }
1220 return error; 1212 return error;
1221} 1213}