GFS2: Clean up reservation removal
The reservation for an inode should be cleared when it is truncated so that we can start again at a different offset for future allocations. We could try and do better than that, by resetting the search based on where the truncation started from, but this is only a first step. In addition, there are three callers of gfs2_rs_delete() but only one of those should really be testing the value of i_writecount. While we get away with that in the other cases currently, I think it would be better if we made that test specific to the one case which requires it. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
@@ -1279,6 +1279,7 @@ do_grow_qunlock:
|
||||
|
||||
int gfs2_setattr_size(struct inode *inode, u64 newsize)
|
||||
{
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
int ret;
|
||||
u64 oldsize;
|
||||
|
||||
@@ -1294,7 +1295,7 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
|
||||
|
||||
inode_dio_wait(inode);
|
||||
|
||||
ret = gfs2_rs_alloc(GFS2_I(inode));
|
||||
ret = gfs2_rs_alloc(ip);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
@@ -1304,6 +1305,7 @@ 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);
|
||||
|
Reference in New Issue
Block a user