aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-07-19 15:29:10 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-07-23 12:08:00 -0400
commitef97ef26d263fb65f0c7446a10cf93201dc0388c (patch)
treee6e9790ace9fe29a78df729eb509935cf32cba7e
parent0b04b6b875b32f2b32263ba46d54d001e05724f9 (diff)
xfs: clean up xfs_btree_del_cursor callers
Less trivial cleanups of the error argument to xfs_btree_del_cursor; these require some minor code refactoring. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/xfs/libxfs/xfs_refcount.c11
-rw-r--r--fs/xfs/scrub/repair.c7
2 files changed, 6 insertions, 12 deletions
diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
index a2dfae67ade1..9ef1f440a6f2 100644
--- a/fs/xfs/libxfs/xfs_refcount.c
+++ b/fs/xfs/libxfs/xfs_refcount.c
@@ -1675,11 +1675,11 @@ xfs_refcount_recover_cow_leftovers(
1675 high.rc.rc_startblock = -1U; 1675 high.rc.rc_startblock = -1U;
1676 error = xfs_btree_query_range(cur, &low, &high, 1676 error = xfs_btree_query_range(cur, &low, &high,
1677 xfs_refcount_recover_extent, &debris); 1677 xfs_refcount_recover_extent, &debris);
1678 if (error) 1678 xfs_btree_del_cursor(cur, error);
1679 goto out_cursor;
1680 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
1681 xfs_trans_brelse(tp, agbp); 1679 xfs_trans_brelse(tp, agbp);
1682 xfs_trans_cancel(tp); 1680 xfs_trans_cancel(tp);
1681 if (error)
1682 goto out_free;
1683 1683
1684 /* Now iterate the list to free the leftovers */ 1684 /* Now iterate the list to free the leftovers */
1685 list_for_each_entry_safe(rr, n, &debris, rr_list) { 1685 list_for_each_entry_safe(rr, n, &debris, rr_list) {
@@ -1727,11 +1727,6 @@ out_free:
1727 kmem_free(rr); 1727 kmem_free(rr);
1728 } 1728 }
1729 return error; 1729 return error;
1730
1731out_cursor:
1732 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
1733 xfs_trans_brelse(tp, agbp);
1734 goto out_trans;
1735} 1730}
1736 1731
1737/* Is there a record covering a given extent? */ 1732/* Is there a record covering a given extent? */
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
index 35c589a04fac..ea39e2bdc96a 100644
--- a/fs/xfs/scrub/repair.c
+++ b/fs/xfs/scrub/repair.c
@@ -747,9 +747,9 @@ xfs_repair_dispose_btree_block(
747 747
748 /* Can we find any other rmappings? */ 748 /* Can we find any other rmappings? */
749 error = xfs_rmap_has_other_keys(cur, agbno, 1, oinfo, &has_other_rmap); 749 error = xfs_rmap_has_other_keys(cur, agbno, 1, oinfo, &has_other_rmap);
750 xfs_btree_del_cursor(cur, error);
750 if (error) 751 if (error)
751 goto out_cur; 752 goto out_free;
752 xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
753 753
754 /* 754 /*
755 * If there are other rmappings, this block is cross linked and must 755 * If there are other rmappings, this block is cross linked and must
@@ -779,8 +779,7 @@ xfs_repair_dispose_btree_block(
779 return xfs_trans_roll_inode(&sc->tp, sc->ip); 779 return xfs_trans_roll_inode(&sc->tp, sc->ip);
780 return xfs_repair_roll_ag_trans(sc); 780 return xfs_repair_roll_ag_trans(sc);
781 781
782out_cur: 782out_free:
783 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
784 if (agf_bp != sc->sa.agf_bp) 783 if (agf_bp != sc->sa.agf_bp)
785 xfs_trans_brelse(sc->tp, agf_bp); 784 xfs_trans_brelse(sc->tp, agf_bp);
786 return error; 785 return error;