]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: move xfs_rmap_update_defer_add to xfs_rmap_item.c
authorDarrick J. Wong <djwong@kernel.org>
Thu, 16 Nov 2023 20:54:31 +0000 (12:54 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 22 Nov 2023 23:03:37 +0000 (15:03 -0800)
Move the code that adds the incore xfs_rmap_update_item deferred work
data to a transaction live with the RUI log item code.  This means that
the rmap code no longer has to know about the inner workings of the RUI
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_rmap.c
libxfs/xfs_rmap.h

index e4f7f63aeacc3fe94751f2678968c262d1d9f3ff..5be7c40ba88e65d6f87f6da1678a7fef6c3ed359 100644 (file)
@@ -317,21 +317,18 @@ xfs_rmap_update_create_done(
        return NULL;
 }
 
-/* Take an active ref to the AG containing the space we're rmapping. */
+/* Add this deferred RUI to the transaction. */
 void
-xfs_rmap_update_get_group(
-       struct xfs_mount        *mp,
+xfs_rmap_defer_add(
+       struct xfs_trans        *tp,
        struct xfs_rmap_intent  *ri)
 {
-       ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_bmap.br_startblock);
-}
+       struct xfs_mount        *mp = tp->t_mountp;
 
-/* Release an active AG ref after finishing rmapping work. */
-static inline void
-xfs_rmap_update_put_group(
-       struct xfs_rmap_intent  *ri)
-{
-       xfs_perag_intent_put(ri->ri_pag);
+       trace_xfs_rmap_defer(mp, ri);
+
+       ri->ri_pag = xfs_perag_intent_get(mp, ri->ri_bmap.br_startblock);
+       xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_RMAP, &ri->ri_list);
 }
 
 /* Cancel a deferred rmap update. */
@@ -341,7 +338,7 @@ xfs_rmap_update_cancel_item(
 {
        struct xfs_rmap_intent          *ri = ri_entry(item);
 
-       xfs_rmap_update_put_group(ri);
+       xfs_perag_intent_put(ri->ri_pag);
        kmem_cache_free(xfs_rmap_intent_cache, ri);
 }
 
index d2406e90e8df9678e73eb3f030e230d1e8289a96..e18d7ae94349d9c3899b18471477ef6a28178423 100644 (file)
@@ -20,4 +20,8 @@ void xfs_extent_free_defer_add(struct xfs_trans *tp,
                struct xfs_extent_free_item *xefi,
                struct xfs_defer_pending **dfpp);
 
+struct xfs_rmap_intent;
+
+void xfs_rmap_defer_add(struct xfs_trans *tp, struct xfs_rmap_intent *ri);
+
 #endif /* __LIBXFS_DEFER_ITEM_H_ */
index 4bdf6864cd23e1089aaaf2657f9c5d8bc07c704e..1718b0c760fe2592057aa1ae552117d1591fe2ab 100644 (file)
@@ -23,6 +23,7 @@
 #include "xfs_inode.h"
 #include "xfs_ag.h"
 #include "xfs_health.h"
+#include "defer_item.h"
 
 struct kmem_cache      *xfs_rmap_intent_cache;
 
@@ -2646,10 +2647,7 @@ __xfs_rmap_add(
        ri->ri_whichfork = whichfork;
        ri->ri_bmap = *bmap;
 
-       trace_xfs_rmap_defer(tp->t_mountp, ri);
-
-       xfs_rmap_update_get_group(tp->t_mountp, ri);
-       xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_RMAP, &ri->ri_list);
+       xfs_rmap_defer_add(tp, ri);
 }
 
 /* Map an extent into a file. */
index 1e14d36f864ed1ce49cb1f0810d5458749adc328..b8d85f23b2725340d2176ceb053b9cfaefcf8c7c 100644 (file)
@@ -176,9 +176,6 @@ struct xfs_rmap_intent {
        struct xfs_perag                        *ri_pag;
 };
 
-void xfs_rmap_update_get_group(struct xfs_mount *mp,
-               struct xfs_rmap_intent *ri);
-
 /* functions for updating the rmapbt based on bmbt map/unmap operations */
 void xfs_rmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
                int whichfork, struct xfs_bmbt_irec *imap);