]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: reuse xfs_refcount_update_cancel_item
authorDarrick J. Wong <djwong@kernel.org>
Tue, 9 Jan 2024 17:40:24 +0000 (09:40 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 10 Apr 2024 00:21:45 +0000 (17:21 -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 a071038398373d21193cc7b02b9a0d506cca5780..b8fdf6ebf5f277487ed1580e577d6a5179f0f293 100644 (file)
@@ -544,6 +544,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(
@@ -564,8 +575,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;
 }
 
@@ -576,17 +586,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,