]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
xfs: return the busy generation from xfs_extent_busy_list_empty
authorChristoph Hellwig <hch@lst.de>
Mon, 4 Nov 2024 04:18:42 +0000 (20:18 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 5 Nov 2024 21:38:28 +0000 (13:38 -0800)
This avoid having to poke into the internals of the busy tracking in
xrep_setup_ag_allocbt.

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>
fs/xfs/scrub/alloc_repair.c
fs/xfs/xfs_extent_busy.c
fs/xfs/xfs_extent_busy.h

index ab0084c42496570e050d00f9640c6404e0209110..f07cd93012c6750fb86f1ce581a355f896b69288 100644 (file)
@@ -132,16 +132,12 @@ int
 xrep_setup_ag_allocbt(
        struct xfs_scrub        *sc)
 {
-       unsigned int            busy_gen;
-
        /*
         * Make sure the busy extent list is clear because we can't put extents
         * on there twice.
         */
-       busy_gen = READ_ONCE(sc->sa.pag->pagb_gen);
-       if (xfs_extent_busy_list_empty(sc->sa.pag))
+       if (xfs_extent_busy_list_empty(sc->sa.pag, &busy_gen))
                return 0;
-
        return xfs_extent_busy_flush(sc->tp, sc->sa.pag, busy_gen, 0);
 }
 
@@ -849,6 +845,7 @@ xrep_allocbt(
 {
        struct xrep_abt         *ra;
        struct xfs_mount        *mp = sc->mp;
+       unsigned int            busy_gen;
        char                    *descr;
        int                     error;
 
@@ -869,7 +866,7 @@ xrep_allocbt(
         * on there twice.  In theory we cleared this before we started, but
         * let's not risk the filesystem.
         */
-       if (!xfs_extent_busy_list_empty(sc->sa.pag)) {
+       if (!xfs_extent_busy_list_empty(sc->sa.pag, &busy_gen)) {
                error = -EDEADLOCK;
                goto out_ra;
        }
index 3d5a57d7ac5e1417e50c624ea29da13767a6d0e0..2806fc6ab4800d5a31f7438dac838ef127f89d74 100644 (file)
@@ -667,12 +667,14 @@ xfs_extent_busy_ag_cmp(
 /* Are there any busy extents in this AG? */
 bool
 xfs_extent_busy_list_empty(
-       struct xfs_perag        *pag)
+       struct xfs_perag        *pag,
+       unsigned                *busy_gen)
 {
        bool                    res;
 
        spin_lock(&pag->pagb_lock);
        res = RB_EMPTY_ROOT(&pag->pagb_tree);
+       *busy_gen = READ_ONCE(pag->pagb_gen);
        spin_unlock(&pag->pagb_lock);
        return res;
 }
index 7241035ce4ef9d55df3a0423678a58144d84838f..c803dcd124a62857302996aaae6812ee312cf6af 100644 (file)
@@ -83,6 +83,6 @@ static inline void xfs_extent_busy_sort(struct list_head *list)
        list_sort(NULL, list, xfs_extent_busy_ag_cmp);
 }
 
-bool xfs_extent_busy_list_empty(struct xfs_perag *pag);
+bool xfs_extent_busy_list_empty(struct xfs_perag *pag, unsigned int *busy_gen);
 
 #endif /* __XFS_EXTENT_BUSY_H__ */