]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: reuse xfs_refcount_update_cancel_item
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:21:42 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:13:14 +0000 (17:13 -0700)
Reuse xfs_refcount_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>
libxfs/defer_item.c

index 53902d775b8277d894dd9105f88c293f99c80a51..8cf3605678a4041693f48fc245299e493dc71a1c 100644 (file)
@@ -381,6 +381,17 @@ xfs_refcount_update_put_group(
        xfs_perag_intent_put(ri->ri_pag);
 }
 
+/* Cancel a deferred refcount update. */
+STATIC void
+xfs_refcount_update_cancel_item(
+       struct list_head                *item)
+{
+       struct xfs_refcount_intent      *ri = ci_entry(item);
+
+       xfs_refcount_update_put_group(ri);
+       kmem_cache_free(xfs_refcount_intent_cache, ri);
+}
+
 /* Process a deferred refcount update. */
 STATIC int
 xfs_refcount_update_finish_item(
@@ -401,8 +412,7 @@ xfs_refcount_update_finish_item(
                return -EAGAIN;
        }
 
-       xfs_refcount_update_put_group(ri);
-       kmem_cache_free(xfs_refcount_intent_cache, ri);
+       xfs_refcount_update_cancel_item(item);
        return error;
 }
 
@@ -413,17 +423,6 @@ xfs_refcount_update_abort_intent(
 {
 }
 
-/* Cancel a deferred refcount update. */
-STATIC void
-xfs_refcount_update_cancel_item(
-       struct list_head                *item)
-{
-       struct xfs_refcount_intent      *ri = ci_entry(item);
-
-       xfs_refcount_update_put_group(ri);
-       kmem_cache_free(xfs_refcount_intent_cache, ri);
-}
-
 const struct xfs_defer_op_type xfs_refcount_update_defer_type = {
        .name           = "refcount",
        .create_intent  = xfs_refcount_update_create_intent,