]> 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>
Thu, 16 Nov 2023 22:48:43 +0000 (14:48 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 22 Nov 2023 23:03:40 +0000 (15:03 -0800)
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 00026c35db482aa7eb1c2392f904deb1c2ae4e14..a6e3202abf56eb9f778697e1ef565d56ae50631d 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 = {
        .create_intent  = xfs_refcount_update_create_intent,
        .abort_intent   = xfs_refcount_update_abort_intent,
index 7c0d7a5f048cde0632f13f88f945651366627414..131eafa3bd03481d6759e05fc3268ad2722bf9c7 100644 (file)
@@ -1307,23 +1307,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.
@@ -1387,7 +1370,7 @@ xfs_refcount_finish_one(
        if (rcur != NULL && rcur->bc_ag.pag != ri->ri_pag) {
                nr_ops = rcur->bc_ag.refc.nr_ops;
                shape_changes = rcur->bc_ag.refc.shape_changes;
-               xfs_refcount_finish_one_cleanup(tp, rcur, 0);
+               xfs_btree_del_cursor(rcur, 0);
                rcur = NULL;
                *pcur = NULL;
        }
index 7713bb908bdcf8bbc50eee0184716db135dd83bb..e355702cf77340b5d7f5e0c4e3838cc5ac9a2136 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);