]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: reuse xfs_bmap_update_cancel_item
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:01:15 +0000 (10:01 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:41 +0000 (11:37 -0700)
Reuse xfs_bmap_update_cancel_item to put the AG/RTG and free the item in
a few places that currently open code the logic.

Inspired-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/defer_item.c

index d19322a0b255b3aaa9dccacc8752df285096ab5b..36811c7fece1c480a33473ce2e4c7e544dd5f006 100644 (file)
@@ -522,6 +522,17 @@ xfs_bmap_update_put_group(
        xfs_perag_intent_put(bi->bi_pag);
 }
 
+/* Cancel a deferred rmap update. */
+STATIC void
+xfs_bmap_update_cancel_item(
+       struct list_head                *item)
+{
+       struct xfs_bmap_intent          *bi = bi_entry(item);
+
+       xfs_bmap_update_put_group(bi);
+       kmem_cache_free(xfs_bmap_intent_cache, bi);
+}
+
 /* Process a deferred rmap update. */
 STATIC int
 xfs_bmap_update_finish_item(
@@ -539,8 +550,7 @@ xfs_bmap_update_finish_item(
                return -EAGAIN;
        }
 
-       xfs_bmap_update_put_group(bi);
-       kmem_cache_free(xfs_bmap_intent_cache, bi);
+       xfs_bmap_update_cancel_item(item);
        return error;
 }
 
@@ -551,17 +561,6 @@ xfs_bmap_update_abort_intent(
 {
 }
 
-/* Cancel a deferred rmap update. */
-STATIC void
-xfs_bmap_update_cancel_item(
-       struct list_head                *item)
-{
-       struct xfs_bmap_intent          *bi = bi_entry(item);
-
-       xfs_bmap_update_put_group(bi);
-       kmem_cache_free(xfs_bmap_intent_cache, bi);
-}
-
 const struct xfs_defer_op_type xfs_bmap_update_defer_type = {
        .name           = "bmap",
        .create_intent  = xfs_bmap_update_create_intent,