From: Darrick J. Wong Date: Wed, 2 Oct 2024 01:22:08 +0000 (-0700) Subject: xfs: don't bother calling xfs_refcount_finish_one_cleanup in xfs_refcount_finish_one X-Git-Tag: v6.11.0~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a344868860be20633e27c1a8d0034bd6ab935330;p=thirdparty%2Fxfsprogs-dev.git xfs: don't bother calling xfs_refcount_finish_one_cleanup in xfs_refcount_finish_one Source kernel commit: bac3f784925299b5e69a857e7e03e59c88aa14be In xfs_refcount_finish_one we know the cursor is non-zero when calling xfs_refcount_finish_one_cleanup and we pass a 0 error variable. This means xfs_refcount_finish_one_cleanup is just doing a xfs_btree_del_cursor. Open code that and move xfs_refcount_finish_one_cleanup to fs/xfs/xfs_refcount_item.c. Inspired-by: Christoph Hellwig Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index 8cf36056..f6560a6b 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -423,6 +423,23 @@ xfs_refcount_update_abort_intent( { } +/* Clean up after calling xfs_refcount_finish_one. */ +STATIC void +xfs_refcount_finish_one_cleanup( + struct xfs_trans *tp, + struct xfs_btree_cur *rcur, + int error) +{ + struct xfs_buf *agbp; + + if (rcur == NULL) + return; + agbp = rcur->bc_ag.agbp; + xfs_btree_del_cursor(rcur, error); + if (error) + xfs_trans_brelse(tp, agbp); +} + const struct xfs_defer_op_type xfs_refcount_update_defer_type = { .name = "refcount", .create_intent = xfs_refcount_update_create_intent, diff --git a/libxfs/xfs_refcount.c b/libxfs/xfs_refcount.c index 14d1101b..4b9a8be3 100644 --- a/libxfs/xfs_refcount.c +++ b/libxfs/xfs_refcount.c @@ -1299,23 +1299,6 @@ out_error: return error; } -/* Clean up after calling xfs_refcount_finish_one. */ -void -xfs_refcount_finish_one_cleanup( - struct xfs_trans *tp, - struct xfs_btree_cur *rcur, - int error) -{ - struct xfs_buf *agbp; - - if (rcur == NULL) - return; - agbp = rcur->bc_ag.agbp; - xfs_btree_del_cursor(rcur, error); - if (error) - xfs_trans_brelse(tp, agbp); -} - /* * Set up a continuation a deferred refcount operation by updating the intent. * Checks to make sure we're not going to run off the end of the AG. @@ -1379,7 +1362,7 @@ xfs_refcount_finish_one( if (rcur != NULL && rcur->bc_ag.pag != ri->ri_pag) { nr_ops = rcur->bc_refc.nr_ops; shape_changes = rcur->bc_refc.shape_changes; - xfs_refcount_finish_one_cleanup(tp, rcur, 0); + xfs_btree_del_cursor(rcur, 0); rcur = NULL; *pcur = NULL; } diff --git a/libxfs/xfs_refcount.h b/libxfs/xfs_refcount.h index 01a20621..c94b8f71 100644 --- a/libxfs/xfs_refcount.h +++ b/libxfs/xfs_refcount.h @@ -82,8 +82,6 @@ void xfs_refcount_increase_extent(struct xfs_trans *tp, void xfs_refcount_decrease_extent(struct xfs_trans *tp, struct xfs_bmbt_irec *irec); -extern void xfs_refcount_finish_one_cleanup(struct xfs_trans *tp, - struct xfs_btree_cur *rcur, int error); extern int xfs_refcount_finish_one(struct xfs_trans *tp, struct xfs_refcount_intent *ri, struct xfs_btree_cur **pcur);