diff options
author | Brian Foster <bfoster@redhat.com> | 2018-07-12 07:26:19 +0200 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-07-12 07:26:19 +0200 |
commit | bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb (patch) | |
tree | 9fbdeaca5d91293ee5ed2604443893276b3d029e /fs/xfs/xfs_bmap_util.c | |
parent | xfs: use ->t_dfops in reflink cow recover path (diff) | |
download | linux-bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb.tar.xz linux-bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb.zip |
xfs: refactor dfops init to attach to transaction
Most callers of xfs_defer_init() immediately attach the dfops
structure to a transaction. Add a transaction parameter to eliminate
much of this boilerplate code. This also helps self-document the
fact that many codepaths now expect a dfops pointer implicitly via
xfs_trans->t_dfops.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 6bea8df348bc..1259e599158d 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -972,8 +972,7 @@ xfs_alloc_file_space( xfs_trans_ijoin(tp, ip, 0); - xfs_defer_init(&dfops, &firstfsb); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &firstfsb); error = xfs_bmapi_write(tp, ip, startoffset_fsb, allocatesize_fsb, alloc_type, &firstfsb, resblks, imapp, &nimaps); @@ -1043,8 +1042,7 @@ xfs_unmap_extent( xfs_trans_ijoin(tp, ip, 0); - xfs_defer_init(&dfops, &firstfsb); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &firstfsb); error = xfs_bunmapi(tp, ip, startoffset_fsb, len_fsb, 0, 2, &firstfsb, done); if (error) @@ -1347,8 +1345,7 @@ xfs_collapse_file_space( goto out_trans_cancel; xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); error = xfs_bmap_collapse_extents(tp, ip, &next_fsb, shift_fsb, &done, &first_block); if (error) @@ -1427,8 +1424,7 @@ xfs_insert_file_space( xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); - xfs_defer_init(&dfops, &first_block); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &first_block); error = xfs_bmap_insert_extents(tp, ip, &next_fsb, shift_fsb, &done, stop_fsb, &first_block); if (error) @@ -1615,7 +1611,7 @@ xfs_swap_extent_rmap( /* Unmap the old blocks in the source file. */ while (tirec.br_blockcount) { - xfs_defer_init(tp->t_dfops, &firstfsb); + xfs_defer_init(tp, tp->t_dfops, &firstfsb); trace_xfs_swap_extent_rmap_remap_piece(tip, &tirec); /* Read extent from the source file */ @@ -1920,8 +1916,7 @@ xfs_swap_extents( error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp); if (error) goto out_unlock; - xfs_defer_init(&dfops, &firstfsb); - tp->t_dfops = &dfops; + xfs_defer_init(tp, &dfops, &firstfsb); /* * Lock and join the inodes to the tansaction so that transaction commit |