]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: move the online repair rmap hooks to the generic group structure
authorChristoph Hellwig <hch@lst.de>
Mon, 25 Nov 2024 21:14:15 +0000 (13:14 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 24 Dec 2024 02:01:24 +0000 (18:01 -0800)
Source kernel commit: eb4a84a3c2bd09efe770fa940fb68e349f90c8c6

Prepare for the upcoming realtime groups feature by moving the online
repair rmap hooks to based to the generic xfs_group structure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_ag.c
libxfs/xfs_ag.h
libxfs/xfs_group.c
libxfs/xfs_group.h
libxfs/xfs_rmap.c
libxfs/xfs_rmap.h

index d67e40f49a3fc03404295ead0177ede46992cae2..1542fea06e305e3bcfcc5ebd6879e5d6d6ef5327 100644 (file)
@@ -233,7 +233,6 @@ xfs_perag_alloc(
        INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
        init_waitqueue_head(&pag->pagb_wait);
        pag->pagb_tree = RB_ROOT;
-       xfs_hooks_init(&pag->pag_rmap_update_hooks);
 #endif /* __KERNEL__ */
 
        error = xfs_buf_cache_init(&pag->pag_bcache);
index 45f8de06cdbc8abf5f56a90f66c484353df83e6c..042ee0913fb9b9c97fc631affa5db6b765eb2c3e 100644 (file)
@@ -96,9 +96,6 @@ struct xfs_perag {
 
        /* background prealloc block trimming */
        struct delayed_work     pag_blockgc_work;
-
-       /* Hook to feed rmapbt updates to an active online repair. */
-       struct xfs_hooks        pag_rmap_update_hooks;
 #endif /* __KERNEL__ */
 };
 
index dfcebf2e9b30f85f25f124fac198fafe41a03004..58ace330a765cfcdf8312a4525ea6fd09c3d9872 100644 (file)
@@ -185,6 +185,7 @@ xfs_group_insert(
 
 #ifdef __KERNEL__
        spin_lock_init(&xg->xg_state_lock);
+       xfs_hooks_init(&xg->xg_rmap_update_hooks);
 #endif
        xfs_defer_drain_init(&xg->xg_intents_drain);
 
index ebefbba7d98cc21568c0ea66b4266d0a0f0eb343..a87b9b80ef75168bfb56f82883f079e7748031bf 100644 (file)
@@ -31,6 +31,11 @@ struct xfs_group {
         * inconsistencies.
         */
        struct xfs_defer_drain  xg_intents_drain;
+
+       /*
+        * Hook to feed rmapbt updates to an active online repair.
+        */
+       struct xfs_hooks        xg_rmap_update_hooks;
 #endif /* __KERNEL__ */
 };
 
index 0f7dee40bda87a16fb60335acc8b6dd92dcbbcd6..e13f4aa7e99538705fee05b3b3d987eabb88e5c2 100644 (file)
@@ -834,7 +834,7 @@ xfs_rmap_hook_enable(void)
 static inline void
 xfs_rmap_update_hook(
        struct xfs_trans                *tp,
-       struct xfs_perag                *pag,
+       struct xfs_group                *xg,
        enum xfs_rmap_intent_type       op,
        xfs_agblock_t                   startblock,
        xfs_extlen_t                    blockcount,
@@ -849,27 +849,27 @@ xfs_rmap_update_hook(
                        .oinfo          = *oinfo, /* struct copy */
                };
 
-               if (pag)
-                       xfs_hooks_call(&pag->pag_rmap_update_hooks, op, &p);
+               if (xg)
+                       xfs_hooks_call(&xg->xg_rmap_update_hooks, op, &p);
        }
 }
 
 /* Call the specified function during a reverse mapping update. */
 int
 xfs_rmap_hook_add(
-       struct xfs_perag        *pag,
+       struct xfs_group        *xg,
        struct xfs_rmap_hook    *hook)
 {
-       return xfs_hooks_add(&pag->pag_rmap_update_hooks, &hook->rmap_hook);
+       return xfs_hooks_add(&xg->xg_rmap_update_hooks, &hook->rmap_hook);
 }
 
 /* Stop calling the specified function during a reverse mapping update. */
 void
 xfs_rmap_hook_del(
-       struct xfs_perag        *pag,
+       struct xfs_group        *xg,
        struct xfs_rmap_hook    *hook)
 {
-       xfs_hooks_del(&pag->pag_rmap_update_hooks, &hook->rmap_hook);
+       xfs_hooks_del(&xg->xg_rmap_update_hooks, &hook->rmap_hook);
 }
 
 /* Configure rmap update hook functions. */
@@ -904,7 +904,8 @@ xfs_rmap_free(
                return 0;
 
        cur = xfs_rmapbt_init_cursor(mp, tp, agbp, pag);
-       xfs_rmap_update_hook(tp, pag, XFS_RMAP_UNMAP, bno, len, false, oinfo);
+       xfs_rmap_update_hook(tp, pag_group(pag), XFS_RMAP_UNMAP, bno, len,
+                       false, oinfo);
        error = xfs_rmap_unmap(cur, bno, len, false, oinfo);
 
        xfs_btree_del_cursor(cur, error);
@@ -1148,7 +1149,8 @@ xfs_rmap_alloc(
                return 0;
 
        cur = xfs_rmapbt_init_cursor(mp, tp, agbp, pag);
-       xfs_rmap_update_hook(tp, pag, XFS_RMAP_MAP, bno, len, false, oinfo);
+       xfs_rmap_update_hook(tp, pag_group(pag), XFS_RMAP_MAP, bno, len, false,
+                       oinfo);
        error = xfs_rmap_map(cur, bno, len, false, oinfo);
 
        xfs_btree_del_cursor(cur, error);
@@ -2619,8 +2621,8 @@ xfs_rmap_finish_one(
        if (error)
                return error;
 
-       xfs_rmap_update_hook(tp, ri->ri_pag, ri->ri_type, bno,
-                       ri->ri_bmap.br_blockcount, unwritten, &oinfo);
+       xfs_rmap_update_hook(tp, pag_group(ri->ri_pag), ri->ri_type, bno,
+                            ri->ri_bmap.br_blockcount, unwritten, &oinfo);
        return 0;
 }
 
index b783dd4dd95d1abe73c4697f50fdd05efb11d518..d409b463bc666268a5cd313dcef36e0806042d4f 100644 (file)
@@ -264,8 +264,8 @@ struct xfs_rmap_hook {
 void xfs_rmap_hook_disable(void);
 void xfs_rmap_hook_enable(void);
 
-int xfs_rmap_hook_add(struct xfs_perag *pag, struct xfs_rmap_hook *hook);
-void xfs_rmap_hook_del(struct xfs_perag *pag, struct xfs_rmap_hook *hook);
+int xfs_rmap_hook_add(struct xfs_group *xg, struct xfs_rmap_hook *hook);
+void xfs_rmap_hook_del(struct xfs_group *xg, struct xfs_rmap_hook *hook);
 void xfs_rmap_hook_setup(struct xfs_rmap_hook *hook, notifier_fn_t mod_fn);
 #endif