Skip to content

Commit

Permalink
xfs: clean up xfs_btree_del_cursor callers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Darrick J. Wong committed Jul 23, 2018
1 parent 0b04b6b commit ef97ef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
11 changes: 3 additions & 8 deletions fs/xfs/libxfs/xfs_refcount.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,11 +1675,11 @@ xfs_refcount_recover_cow_leftovers(
high.rc.rc_startblock = -1U;
error = xfs_btree_query_range(cur, &low, &high,
xfs_refcount_recover_extent, &debris);
if (error)
goto out_cursor;
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
xfs_btree_del_cursor(cur, error);
xfs_trans_brelse(tp, agbp);
xfs_trans_cancel(tp);
if (error)
goto out_free;

/* Now iterate the list to free the leftovers */
list_for_each_entry_safe(rr, n, &debris, rr_list) {
Expand Down Expand Up @@ -1727,11 +1727,6 @@ xfs_refcount_recover_cow_leftovers(
kmem_free(rr);
}
return error;

out_cursor:
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
xfs_trans_brelse(tp, agbp);
goto out_trans;
}

/* Is there a record covering a given extent? */
Expand Down
7 changes: 3 additions & 4 deletions fs/xfs/scrub/repair.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,9 @@ xfs_repair_dispose_btree_block(

/* Can we find any other rmappings? */
error = xfs_rmap_has_other_keys(cur, agbno, 1, oinfo, &has_other_rmap);
xfs_btree_del_cursor(cur, error);
if (error)
goto out_cur;
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
goto out_free;

/*
* If there are other rmappings, this block is cross linked and must
Expand Down Expand Up @@ -779,8 +779,7 @@ xfs_repair_dispose_btree_block(
return xfs_trans_roll_inode(&sc->tp, sc->ip);
return xfs_repair_roll_ag_trans(sc);

out_cur:
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
out_free:
if (agf_bp != sc->sa.agf_bp)
xfs_trans_brelse(sc->tp, agf_bp);
return error;
Expand Down

0 comments on commit ef97ef2

Please sign in to comment.