]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: move xfs_rmap_update_defer_add to xfs_rmap_item.c
authorDarrick J. Wong <djwong@kernel.org>
Wed, 2 Oct 2024 01:20:19 +0000 (18:20 -0700)
committerAndrey Albershteyn <aalbersh@redhat.com>
Fri, 4 Oct 2024 10:42:07 +0000 (12:42 +0200)
Source kernel commit: ea7b0820d960d5a3ee72bc67cbd8b5d47c67aa4c

Move the code that adds the incore xfs_rmap_update_item deferred work
data to a transaction to 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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/defer_item.c
libxfs/defer_item.h
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h

index 7721267e4315ac170a4d37d680d4c2e64c0ad2d1..1c106b8443856813518b62f26c9a7c931728dcaf 100644 (file)
@@ -243,21 +243,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, &ri->ri_list, &xfs_rmap_update_defer_type);
 }
 
 /* Cancel a deferred rmap update. */
@@ -267,7 +264,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 03f3f1505d481af35af8a934cc1ac537ec7b84e2..be354785bcda6712a5ea6234a7abcd9399639817 100644 (file)
@@ -30,4 +30,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 d60edaa23638dd94814f513609937f685419e8d1..22947e3c9ae31083c55d52dcc842c036525c4bb1 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;
 
@@ -2655,10 +2656,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, &ri->ri_list, &xfs_rmap_update_defer_type);
+       xfs_rmap_defer_add(tp, ri);
 }
 
 /* Map an extent into a file. */
index 9d85dd2a6553cc27e55088dd768c04c58fff3be4..b783dd4dd95d1abe73c4697f50fdd05efb11d518 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);