summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorBrian Foster2018-07-12 07:26:19 +0200
committerDarrick J. Wong2018-07-12 07:26:19 +0200
commitbcd2c9f33559764e0d306e226a8aa88bc2e1e6fb (patch)
tree9fbdeaca5d91293ee5ed2604443893276b3d029e /fs/xfs/xfs_reflink.c
parentxfs: use ->t_dfops in reflink cow recover path (diff)
downloadkernel-qcow2-linux-bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb.tar.gz
kernel-qcow2-linux-bcd2c9f33559764e0d306e226a8aa88bc2e1e6fb.tar.xz
kernel-qcow2-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_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 8ea4ba0e45d8..bef780171962 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -428,8 +428,7 @@ retry:
xfs_trans_ijoin(tp, ip, 0);
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
nimaps = 1;
/* Allocate the entire reservation as unwritten blocks. */
@@ -517,8 +516,7 @@ xfs_reflink_cancel_cow_blocks(
if (error)
break;
} else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) {
- xfs_defer_init(&dfops, &firstfsb);
- (*tpp)->t_dfops = &dfops;
+ xfs_defer_init(*tpp, &dfops, &firstfsb);
/* Free the CoW orphan record. */
error = xfs_refcount_free_cow_extent(ip->i_mount,
@@ -701,8 +699,7 @@ xfs_reflink_end_cow(
goto prev_extent;
/* Unmap the old blocks in the data fork. */
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
rlen = del.br_blockcount;
error = __xfs_bunmapi(tp, ip, del.br_startoff, &rlen, 0, 1,
&firstfsb);
@@ -1052,8 +1049,7 @@ xfs_reflink_remap_extent(
/* Unmap the old blocks in the data fork. */
rlen = unmap_len;
while (rlen) {
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
error = __xfs_bunmapi(tp, ip, destoff, &rlen, 0, 1, &firstfsb);
if (error)
goto out_defer;