]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: reuse xfs_bmap_update_cancel_item
authorDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:44:20 +0000 (12:44 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 22 Feb 2024 20:44:20 +0000 (12:44 -0800)
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>
fs/xfs/xfs_bmap_item.c

index eb56dc5aae74dd73ac7f7864e1c73c137aef664d..8df5e370c0bb4a68e78cba9e09ff3f8bae91d734 100644 (file)
@@ -343,6 +343,17 @@ xfs_bmap_update_put_group(
        xfs_perag_intent_put(bi->bi_pag);
 }
 
+/* Cancel a deferred bmap 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 bmap update. */
 STATIC int
 xfs_bmap_update_finish_item(
@@ -360,8 +371,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;
 }
 
@@ -373,17 +383,6 @@ xfs_bmap_update_abort_intent(
        xfs_bui_release(BUI_ITEM(intent));
 }
 
-/* Cancel a deferred bmap 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);
-}
-
 /* Is this recovered BUI ok? */
 static inline bool
 xfs_bui_validate(