]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: don't bother calling xfs_refcount_finish_one_cleanup in xfs_refcount_finish_one
authorDarrick J. Wong <djwong@kernel.org>
Tue, 9 Jan 2024 17:44:15 +0000 (09:44 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 10 Apr 2024 00:21:46 +0000 (17:21 -0700)
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 <hch@lst.de>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/defer_item.c
libxfs/xfs_refcount.c
libxfs/xfs_refcount.h

index b8fdf6ebf5f277487ed1580e577d6a5179f0f293..1bb028606ffcef1e11ee4639cc02c98fa732a93c 100644 (file)
@@ -586,6 +586,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,
index 114b5760bf53c774d70de1d358a7d74d82d7fd67..f1447c4370b1652c0cbdf12aa1e05699c21b1a70 100644 (file)
@@ -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;
        }
index 01a20621192ed2d434eaa696fed5e92dfdd199f0..c94b8f71d407b9a54fbd538cfb3164ca88095578 100644 (file)
@@ -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);