aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-09-28 23:41:58 -0400
committerDave Chinner <david@fromorbit.com>2018-09-28 23:41:58 -0400
commitd5a2e2893da0d62c3888c91ae2da798adc17a9b9 (patch)
treedb2dcdff07f1ca24be625bb8b1e727b8d8f02547 /fs/xfs/xfs_bmap_util.c
parentae29478766f4c8e16edca6fe1e25d73c47991ebe (diff)
xfs: remove last of unnecessary xfs_defer_cancel() callers
Now that deferred operations are completely managed via transactions, it's no longer necessary to cancel the dfops in error paths that already cancel the associated transaction. There are a few such calls lingering throughout the codebase. Remove all remaining unnecessary calls to xfs_defer_cancel(). This leaves xfs_defer_cancel() calls in two places. The first is the call in the transaction cancel path itself, which facilitates this patch. The second is made via the xfs_defer_finish() error path to provide consistent error semantics with transaction commit. For example, xfs_trans_commit() expects an xfs_defer_finish() failure to clean up the dfops structure before it returns. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r--fs/xfs/xfs_bmap_util.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index addbd74ecd8e..ae3cc393724f 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1584,7 +1584,7 @@ xfs_swap_extent_rmap(
1584 tirec.br_blockcount, &irec, 1584 tirec.br_blockcount, &irec,
1585 &nimaps, 0); 1585 &nimaps, 0);
1586 if (error) 1586 if (error)
1587 goto out_defer; 1587 goto out;
1588 ASSERT(nimaps == 1); 1588 ASSERT(nimaps == 1);
1589 ASSERT(tirec.br_startoff == irec.br_startoff); 1589 ASSERT(tirec.br_startoff == irec.br_startoff);
1590 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec); 1590 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec);
@@ -1599,22 +1599,22 @@ xfs_swap_extent_rmap(
1599 /* Remove the mapping from the donor file. */ 1599 /* Remove the mapping from the donor file. */
1600 error = xfs_bmap_unmap_extent(tp, tip, &uirec); 1600 error = xfs_bmap_unmap_extent(tp, tip, &uirec);
1601 if (error) 1601 if (error)
1602 goto out_defer; 1602 goto out;
1603 1603
1604 /* Remove the mapping from the source file. */ 1604 /* Remove the mapping from the source file. */
1605 error = xfs_bmap_unmap_extent(tp, ip, &irec); 1605 error = xfs_bmap_unmap_extent(tp, ip, &irec);
1606 if (error) 1606 if (error)
1607 goto out_defer; 1607 goto out;
1608 1608
1609 /* Map the donor file's blocks into the source file. */ 1609 /* Map the donor file's blocks into the source file. */
1610 error = xfs_bmap_map_extent(tp, ip, &uirec); 1610 error = xfs_bmap_map_extent(tp, ip, &uirec);
1611 if (error) 1611 if (error)
1612 goto out_defer; 1612 goto out;
1613 1613
1614 /* Map the source file's blocks into the donor file. */ 1614 /* Map the source file's blocks into the donor file. */
1615 error = xfs_bmap_map_extent(tp, tip, &irec); 1615 error = xfs_bmap_map_extent(tp, tip, &irec);
1616 if (error) 1616 if (error)
1617 goto out_defer; 1617 goto out;
1618 1618
1619 error = xfs_defer_finish(tpp); 1619 error = xfs_defer_finish(tpp);
1620 tp = *tpp; 1620 tp = *tpp;
@@ -1636,8 +1636,6 @@ xfs_swap_extent_rmap(
1636 tip->i_d.di_flags2 = tip_flags2; 1636 tip->i_d.di_flags2 = tip_flags2;
1637 return 0; 1637 return 0;
1638 1638
1639out_defer:
1640 xfs_defer_cancel(tp);
1641out: 1639out:
1642 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_); 1640 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_);
1643 tip->i_d.di_flags2 = tip_flags2; 1641 tip->i_d.di_flags2 = tip_flags2;