summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-07-11 22:26:13 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2018-07-11 22:26:13 -0700
commit4bcfa613a0582a9992a6c2af82273bd770103d12 (patch)
tree07b05f8a462387bc4a8935b0c64f478f9484a979 /fs/xfs/xfs_reflink.c
parent6e702a5dcbe1d38cf479931dd2e2a3da884143f0 (diff)
xfs: use ->t_dfops for all xfs_bunmapi() callers
Use ->t_dfops for all remaining xfs_bunmapi() callers. This prepares the latter to no longer require a dfops parameter. Note that xfs_itruncate_extents_flags() associates a local dfops with a transaction provided from the caller. Since there are multiple callers, set and reset ->t_dfops before the function returns to avoid exposure of stack memory to the caller. 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.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 9f3f144bf9ff..c119cd33766e 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -700,9 +700,10 @@ xfs_reflink_end_cow(
/* Unmap the old blocks in the data fork. */
xfs_defer_init(&dfops, &firstfsb);
+ tp->t_dfops = &dfops;
rlen = del.br_blockcount;
error = __xfs_bunmapi(tp, ip, del.br_startoff, &rlen, 0, 1,
- &firstfsb, &dfops);
+ &firstfsb, tp->t_dfops);
if (error)
goto out_defer;
@@ -714,13 +715,14 @@ xfs_reflink_end_cow(
trace_xfs_reflink_cow_remap(ip, &del);
/* Free the CoW orphan record. */
- error = xfs_refcount_free_cow_extent(tp->t_mountp, &dfops,
+ error = xfs_refcount_free_cow_extent(tp->t_mountp, tp->t_dfops,
del.br_startblock, del.br_blockcount);
if (error)
goto out_defer;
/* Map the new blocks into the data fork. */
- error = xfs_bmap_map_extent(tp->t_mountp, &dfops, ip, &del);
+ error = xfs_bmap_map_extent(tp->t_mountp, tp->t_dfops, ip,
+ &del);
if (error)
goto out_defer;
@@ -731,8 +733,8 @@ xfs_reflink_end_cow(
/* Remove the mapping from the CoW fork. */
xfs_bmap_del_extent_cow(ip, &icur, &got, &del);
- xfs_defer_ijoin(&dfops, ip);
- error = xfs_defer_finish(&tp, &dfops);
+ xfs_defer_ijoin(tp->t_dfops, ip);
+ error = xfs_defer_finish(&tp, tp->t_dfops);
if (error)
goto out_defer;
if (!xfs_iext_get_extent(ifp, &icur, &got))
@@ -750,7 +752,7 @@ prev_extent:
return 0;
out_defer:
- xfs_defer_cancel(&dfops);
+ xfs_defer_cancel(tp->t_dfops);
out_cancel:
xfs_trans_cancel(tp);
xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -1049,8 +1051,9 @@ xfs_reflink_remap_extent(
rlen = unmap_len;
while (rlen) {
xfs_defer_init(&dfops, &firstfsb);
+ tp->t_dfops = &dfops;
error = __xfs_bunmapi(tp, ip, destoff, &rlen, 0, 1,
- &firstfsb, &dfops);
+ &firstfsb, tp->t_dfops);
if (error)
goto out_defer;
@@ -1071,12 +1074,12 @@ xfs_reflink_remap_extent(
uirec.br_blockcount, uirec.br_startblock);
/* Update the refcount tree */
- error = xfs_refcount_increase_extent(mp, &dfops, &uirec);
+ error = xfs_refcount_increase_extent(mp, tp->t_dfops, &uirec);
if (error)
goto out_defer;
/* Map the new blocks into the data fork. */
- error = xfs_bmap_map_extent(mp, &dfops, ip, &uirec);
+ error = xfs_bmap_map_extent(mp, tp->t_dfops, ip, &uirec);
if (error)
goto out_defer;
@@ -1097,8 +1100,8 @@ xfs_reflink_remap_extent(
next_extent:
/* Process all the deferred stuff. */
- xfs_defer_ijoin(&dfops, ip);
- error = xfs_defer_finish(&tp, &dfops);
+ xfs_defer_ijoin(tp->t_dfops, ip);
+ error = xfs_defer_finish(&tp, tp->t_dfops);
if (error)
goto out_defer;
}
@@ -1110,7 +1113,7 @@ next_extent:
return 0;
out_defer:
- xfs_defer_cancel(&dfops);
+ xfs_defer_cancel(tp->t_dfops);
out_cancel:
xfs_trans_cancel(tp);
xfs_iunlock(ip, XFS_ILOCK_EXCL);