xfs: better xfs_trans_alloc interface
Merge xfs_trans_reserve and xfs_trans_alloc into a single function call that returns a transaction with all the required log and block reservations, and which allows passing transaction flags directly to avoid the cumbersome _xfs_trans_alloc interface. While we're at it we also get rid of the transaction type argument that has been superflous since we stopped supporting the non-CIL logging mode. The guts of it will be removed in another patch. [dchinner: fixed transaction leak in error path in xfs_setattr_nonsize] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
f55532a0c0
commit
253f4911f2
@@ -780,15 +780,14 @@ xfs_growfs_rt_alloc(
|
||||
* Allocate space to the file, as necessary.
|
||||
*/
|
||||
while (oblocks < nblocks) {
|
||||
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_ALLOC);
|
||||
resblks = XFS_GROWFSRT_SPACE_RES(mp, nblocks - oblocks);
|
||||
/*
|
||||
* Reserve space & log for one extent added to the file.
|
||||
*/
|
||||
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growrtalloc,
|
||||
resblks, 0);
|
||||
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growrtalloc, resblks,
|
||||
0, 0, &tp);
|
||||
if (error)
|
||||
goto out_trans_cancel;
|
||||
return error;
|
||||
/*
|
||||
* Lock the inode.
|
||||
*/
|
||||
@@ -823,14 +822,13 @@ xfs_growfs_rt_alloc(
|
||||
for (bno = map.br_startoff, fsbno = map.br_startblock;
|
||||
bno < map.br_startoff + map.br_blockcount;
|
||||
bno++, fsbno++) {
|
||||
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_ZERO);
|
||||
/*
|
||||
* Reserve log for one block zeroing.
|
||||
*/
|
||||
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growrtzero,
|
||||
0, 0);
|
||||
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growrtzero,
|
||||
0, 0, 0, &tp);
|
||||
if (error)
|
||||
goto out_trans_cancel;
|
||||
return error;
|
||||
/*
|
||||
* Lock the bitmap inode.
|
||||
*/
|
||||
@@ -994,11 +992,10 @@ xfs_growfs_rt(
|
||||
/*
|
||||
* Start a transaction, get the log reservation.
|
||||
*/
|
||||
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_FREE);
|
||||
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growrtfree,
|
||||
0, 0);
|
||||
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growrtfree, 0, 0, 0,
|
||||
&tp);
|
||||
if (error)
|
||||
goto error_cancel;
|
||||
break;
|
||||
/*
|
||||
* Lock out other callers by grabbing the bitmap inode lock.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user