]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: don't bother calling xfs_rmap_finish_one_cleanup in xfs_rmap_finish_one
authorChristoph Hellwig <hch@lst.de>
Wed, 3 Jul 2024 21:21:40 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:13:14 +0000 (17:13 -0700)
In xfs_rmap_finish_one we known the cursor is non-zero when calling
xfs_rmap_finish_one_cleanup and we pass a 0 error variable.  This means
xfs_rmap_finish_one_cleanup is just doing a xfs_btree_del_cursor.

Open code that and move xfs_rmap_finish_one_cleanup to
fs/xfs/xfs_rmap_item.c.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
[djwong: minor porting changes]
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/defer_item.c
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h

index f8b27c55c8dd7f1d6696f5cdc58bd3999f61f550..7721267e4315ac170a4d37d680d4c2e64c0ad2d1 100644 (file)
@@ -288,6 +288,23 @@ xfs_rmap_update_finish_item(
        return error;
 }
 
+/* Clean up after calling xfs_rmap_finish_one. */
+STATIC void
+xfs_rmap_finish_one_cleanup(
+       struct xfs_trans        *tp,
+       struct xfs_btree_cur    *rcur,
+       int                     error)
+{
+       struct xfs_buf          *agbp = NULL;
+
+       if (rcur == NULL)
+               return;
+       agbp = rcur->bc_ag.agbp;
+       xfs_btree_del_cursor(rcur, error);
+       if (error && agbp)
+               xfs_trans_brelse(tp, agbp);
+}
+
 /* Abort all pending RUIs. */
 STATIC void
 xfs_rmap_update_abort_intent(
index 57c0d9418e5930c50b641fb968bf4003c1131928..1b5004b9c88ece72c58a1bbb3ffb6fb410c1f2fc 100644 (file)
@@ -2522,23 +2522,6 @@ xfs_rmap_query_all(
        return xfs_btree_query_all(cur, xfs_rmap_query_range_helper, &query);
 }
 
-/* Clean up after calling xfs_rmap_finish_one. */
-void
-xfs_rmap_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);
-}
-
 /* Commit an rmap operation into the ondisk tree. */
 int
 __xfs_rmap_finish_intent(
@@ -2603,7 +2586,7 @@ xfs_rmap_finish_one(
         */
        rcur = *pcur;
        if (rcur != NULL && rcur->bc_ag.pag != ri->ri_pag) {
-               xfs_rmap_finish_one_cleanup(tp, rcur, 0);
+               xfs_btree_del_cursor(rcur, 0);
                rcur = NULL;
                *pcur = NULL;
        }
index 731c97137b5a06fd4a6fc48d85dbffd23a8ed693..9d85dd2a6553cc27e55088dd768c04c58fff3be4 100644 (file)
@@ -192,8 +192,6 @@ void xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
 void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
                xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
 
-void xfs_rmap_finish_one_cleanup(struct xfs_trans *tp,
-               struct xfs_btree_cur *rcur, int error);
 int xfs_rmap_finish_one(struct xfs_trans *tp, struct xfs_rmap_intent *ri,
                struct xfs_btree_cur **pcur);
 int __xfs_rmap_finish_intent(struct xfs_btree_cur *rcur,