]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: move xfs_refcount_update_defer_add to xfs_refcount_item.c
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:46 +0000 (17:21 -0700)
Move the code that adds the incore xfs_refcount_update_item deferred
work data to a transaction live with the CUI log item code.  This means
that the refcount code no longer has to know about the inner workings of
the CUI log items.

As a consequence, we can get rid of the _{get,put}_group helpers.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/defer_item.c
libxfs/defer_item.h
libxfs/xfs_refcount.c
libxfs/xfs_refcount.h

index 1bb028606ffcef1e11ee4639cc02c98fa732a93c..74891078ae4c04b7ca111153452bf675e982a80c 100644 (file)
@@ -527,21 +527,18 @@ xfs_refcount_update_create_done(
        return NULL;
 }
 
-/* Take an active ref to the AG containing the space we're refcounting. */
+/* Add this deferred CUI to the transaction. */
 void
-xfs_refcount_update_get_group(
-       struct xfs_mount                *mp,
+xfs_refcount_defer_add(
+       struct xfs_trans                *tp,
        struct xfs_refcount_intent      *ri)
 {
-       ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_startblock);
-}
+       struct xfs_mount                *mp = tp->t_mountp;
 
-/* Release an active AG ref after finishing refcounting work. */
-static inline void
-xfs_refcount_update_put_group(
-       struct xfs_refcount_intent      *ri)
-{
-       xfs_perag_intent_put(ri->ri_pag);
+       trace_xfs_refcount_defer(mp, ri);
+
+       ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_startblock);
+       xfs_defer_add(tp, &ri->ri_list, &xfs_refcount_update_defer_type);
 }
 
 /* Cancel a deferred refcount update. */
@@ -551,7 +548,7 @@ xfs_refcount_update_cancel_item(
 {
        struct xfs_refcount_intent      *ri = ci_entry(item);
 
-       xfs_refcount_update_put_group(ri);
+       xfs_perag_intent_put(ri->ri_pag);
        kmem_cache_free(xfs_refcount_intent_cache, ri);
 }
 
index 9e8cd63c749f4195e616680e65888f1b41b63b80..7e6b939e906ee45363b0e3288d055116466b6c9d 100644 (file)
@@ -36,4 +36,9 @@ struct xfs_rmap_intent;
 
 void xfs_rmap_defer_add(struct xfs_trans *tp, struct xfs_rmap_intent *ri);
 
+struct xfs_refcount_intent;
+
+void xfs_refcount_defer_add(struct xfs_trans *tp,
+               struct xfs_refcount_intent *ri);
+
 #endif /* __LIBXFS_DEFER_ITEM_H_ */
index e15356aa15b5ae047650385426d68684ba844dee..9ea93f391731207c9c8e6ff4d691ae7a0dffbcb4 100644 (file)
@@ -23,6 +23,7 @@
 #include "xfs_rmap.h"
 #include "xfs_ag.h"
 #include "xfs_health.h"
+#include "defer_item.h"
 
 struct kmem_cache      *xfs_refcount_intent_cache;
 
@@ -1434,10 +1435,7 @@ __xfs_refcount_add(
        ri->ri_startblock = startblock;
        ri->ri_blockcount = blockcount;
 
-       trace_xfs_refcount_defer(tp->t_mountp, ri);
-
-       xfs_refcount_update_get_group(tp->t_mountp, ri);
-       xfs_defer_add(tp, &ri->ri_list, &xfs_refcount_update_defer_type);
+       xfs_refcount_defer_add(tp, ri);
 }
 
 /*
index c94b8f71d407b9a54fbd538cfb3164ca88095578..68acb0b1b4a8781598d4bbb8643a7a70f84e19fd 100644 (file)
@@ -74,9 +74,6 @@ xfs_refcount_check_domain(
        return true;
 }
 
-void xfs_refcount_update_get_group(struct xfs_mount *mp,
-               struct xfs_refcount_intent *ri);
-
 void xfs_refcount_increase_extent(struct xfs_trans *tp,
                struct xfs_bmbt_irec *irec);
 void xfs_refcount_decrease_extent(struct xfs_trans *tp,