]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: disable sb_frextents for zoned file systems
authorChristoph Hellwig <hch@lst.de>
Sat, 30 Nov 2024 04:59:54 +0000 (05:59 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 3 Feb 2025 04:49:09 +0000 (05:49 +0100)
Zoned file systems not only don't use the global frextents counter, but
for them the in-memory percpu counter also includes reservations taken
before even allocating delalloc extent records, so it will never match
the per-zone used information.  Disable all updates and verification of
the sb counter for zoned file systems as it isn't useful for them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
fs/xfs/libxfs/xfs_sb.c
fs/xfs/scrub/fscounters.c
fs/xfs/scrub/fscounters_repair.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_super.c

index 71cf5eba94a70c0afd2f71967f6b5f451972126c..64a9e88cb8ec0d20a7b8bb208bb981d8972d5677 100644 (file)
@@ -1333,7 +1333,7 @@ xfs_log_sb(
         * we handle nearly-lockless reservations, so we must use the _positive
         * variant here to avoid writing out nonsense frextents.
         */
-       if (xfs_has_rtgroups(mp)) {
+       if (xfs_has_rtgroups(mp) && !xfs_has_zoned(mp)) {
                mp->m_sb.sb_frextents =
                        xfs_sum_freecounter(mp, XC_FREE_RTEXTENTS);
        }
index 22cac61172ee27f4c3359343eb4a9d77a0d3f493..f7258544848fcdfe1d854dbdca23637c190cbf8b 100644 (file)
@@ -413,7 +413,13 @@ xchk_fscount_count_frextents(
 
        fsc->frextents = 0;
        fsc->frextents_delayed = 0;
-       if (!xfs_has_realtime(mp))
+
+       /*
+        * Don't bother verifying and repairing the fs counters for zoned file
+        * systems as they don't track an on-disk frextents count, and the
+        * in-memory percpu counter also includes reservations.
+        */
+       if (!xfs_has_realtime(mp) || xfs_has_zoned(mp))
                return 0;
 
        while ((rtg = xfs_rtgroup_next(mp, rtg))) {
@@ -597,7 +603,8 @@ xchk_fscounters(
                        try_again = true;
        }
 
-       if (!xchk_fscount_within_range(sc, frextents,
+       if (!xfs_has_zoned(mp) &&
+           !xchk_fscount_within_range(sc, frextents,
                        &mp->m_free[XC_FREE_RTEXTENTS],
                        fsc->frextents - fsc->frextents_delayed)) {
                if (fsc->frozen)
index 8fb0db78489eeffb06b037edffd782959f4f60d2..f0d2b04644e4524aa4829d283df7f2f8dcfc244e 100644 (file)
@@ -74,10 +74,12 @@ xrep_fscounters(
         * track of the delalloc reservations separately, as they are are
         * subtracted from m_frextents, but not included in sb_frextents.
         */
-       xfs_set_freecounter(mp, XC_FREE_RTEXTENTS,
-               fsc->frextents - fsc->frextents_delayed);
-       if (!xfs_has_rtgroups(mp))
-               mp->m_sb.sb_frextents = fsc->frextents;
+       if (!xfs_has_zoned(mp)) {
+               xfs_set_freecounter(mp, XC_FREE_RTEXTENTS,
+                               fsc->frextents - fsc->frextents_delayed);
+               if (!xfs_has_rtgroups(mp))
+                       mp->m_sb.sb_frextents = fsc->frextents;
+       }
 
        return 0;
 }
index 1cce5ad0e7a44f8d95341305c4493725f89ef815..b6004e456ed333c51a67fa1b05062a506841c920 100644 (file)
@@ -556,7 +556,7 @@ xfs_check_summary_counts(
         * If we're mounting the rt volume after recovering the log, recompute
         * frextents from the rtbitmap file to fix the inconsistency.
         */
-       if (xfs_has_realtime(mp) && !xfs_is_clean(mp)) {
+       if (xfs_has_realtime(mp) && !xfs_has_zoned(mp) && !xfs_is_clean(mp)) {
                error = xfs_rtalloc_reinit_frextents(mp);
                if (error)
                        return error;
index 42ca459e6b86cd94e9af636ce11cd91ffee035d5..7a2230b893f106c145141bdb64b3b5bddb954928 100644 (file)
@@ -1130,7 +1130,9 @@ xfs_reinit_percpu_counters(
        percpu_counter_set(&mp->m_icount, mp->m_sb.sb_icount);
        percpu_counter_set(&mp->m_ifree, mp->m_sb.sb_ifree);
        xfs_set_freecounter(mp, XC_FREE_BLOCKS, mp->m_sb.sb_fdblocks);
-       xfs_set_freecounter(mp, XC_FREE_RTEXTENTS, mp->m_sb.sb_frextents);
+       if (!xfs_has_zoned(mp))
+               xfs_set_freecounter(mp, XC_FREE_RTEXTENTS,
+                               mp->m_sb.sb_frextents);
 }
 
 static void