xfs: reuse xfs_rmap_update_cancel_item
authorChristoph Hellwig <hch@lst.de>
Wed, 3 Jul 2024 21:21:40 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 31 Jul 2024 01:46:44 +0000 (18:46 -0700)
Reuse xfs_rmap_update_cancel_item to put the AG/RTG and free the item in
a few places that currently open code the logic.

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

index 013ce0304c42f36d67e3fa06087f1a44cec09d42..f8b27c55c8dd7f1d6696f5cdc58bd3999f61f550 100644 (file)
@@ -260,6 +260,17 @@ xfs_rmap_update_put_group(
        xfs_perag_intent_put(ri->ri_pag);
 }
 
+/* Cancel a deferred rmap update. */
+STATIC void
+xfs_rmap_update_cancel_item(
+       struct list_head                *item)
+{
+       struct xfs_rmap_intent          *ri = ri_entry(item);
+
+       xfs_rmap_update_put_group(ri);
+       kmem_cache_free(xfs_rmap_intent_cache, ri);
+}
+
 /* Process a deferred rmap update. */
 STATIC int
 xfs_rmap_update_finish_item(
@@ -273,8 +284,7 @@ xfs_rmap_update_finish_item(
 
        error = xfs_rmap_finish_one(tp, ri, state);
 
-       xfs_rmap_update_put_group(ri);
-       kmem_cache_free(xfs_rmap_intent_cache, ri);
+       xfs_rmap_update_cancel_item(item);
        return error;
 }
 
@@ -285,17 +295,6 @@ xfs_rmap_update_abort_intent(
 {
 }
 
-/* Cancel a deferred rmap update. */
-STATIC void
-xfs_rmap_update_cancel_item(
-       struct list_head                *item)
-{
-       struct xfs_rmap_intent          *ri = ri_entry(item);
-
-       xfs_rmap_update_put_group(ri);
-       kmem_cache_free(xfs_rmap_intent_cache, ri);
-}
-
 const struct xfs_defer_op_type xfs_rmap_update_defer_type = {
        .name           = "rmap",
        .create_intent  = xfs_rmap_update_create_intent,