GFS2: Make rgrp reservations part of the gfs2_inode structure
Before this patch, multi-block reservation structures were allocated from a special slab. This patch folds the structure into the gfs2_inode structure. The disadvantage is that the gfs2_inode needs more memory, even when a file is opened read-only. The advantages are: (a) we don't need the special slab and the extra time it takes to allocate and deallocate from it. (b) we no longer need to worry that the structure exists for things like quota management. (c) This also allows us to remove the calls to get_write_access and put_write_access since we know the structure will exist. Signed-off-by: Bob Peterson <rpeterso@redhat.com>
This commit is contained in:
@@ -787,8 +787,8 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
|
||||
if (error)
|
||||
goto out_rlist;
|
||||
|
||||
if (gfs2_rs_active(ip->i_res)) /* needs to be done with the rgrp glock held */
|
||||
gfs2_rs_deltree(ip->i_res);
|
||||
if (gfs2_rs_active(&ip->i_res)) /* needs to be done with the rgrp glock held */
|
||||
gfs2_rs_deltree(&ip->i_res);
|
||||
|
||||
error = gfs2_trans_begin(sdp, rg_blocks + RES_DINODE +
|
||||
RES_INDIRECT + RES_STATFS + RES_QUOTA,
|
||||
@@ -1291,10 +1291,6 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = get_write_access(inode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
inode_dio_wait(inode);
|
||||
|
||||
ret = gfs2_rsqa_alloc(ip);
|
||||
@@ -1307,10 +1303,9 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
|
||||
goto out;
|
||||
}
|
||||
|
||||
gfs2_rs_deltree(ip->i_res);
|
||||
ret = do_shrink(inode, oldsize, newsize);
|
||||
out:
|
||||
put_write_access(inode);
|
||||
gfs2_rsqa_delete(ip, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user