From 1520b6a2a6951fbe2615edcc17c162f23a90c71e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 12 May 2024 07:39:45 +0200 Subject: [PATCH] xfs: disable sb_frextents scrub/repair for zoned file systems Zoned file systems not only don't use the frextents counter, but the in-memory percpu couner also includes reservations take before even allocating delalloc extent records, so it will never match the per-zone used information. Signed-off-by: Christoph Hellwig --- fs/xfs/scrub/fscounters.c | 24 ++++++++++++++++-------- fs/xfs/scrub/fscounters_repair.c | 10 ++++++---- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/fs/xfs/scrub/fscounters.c b/fs/xfs/scrub/fscounters.c index c2e55556f21e..c5b7a1d46a51 100644 --- a/fs/xfs/scrub/fscounters.c +++ b/fs/xfs/scrub/fscounters.c @@ -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,13 +603,15 @@ xchk_fscounters( try_again = true; } - if (!xchk_fscount_within_range(sc, frextents, - &mp->m_free[FREE_RTEXTENTS], - fsc->frextents - fsc->frextents_delayed)) { - if (fsc->frozen) - xchk_set_corrupt(sc); - else - try_again = true; + if (!xfs_has_zoned(mp)) { + if (!xchk_fscount_within_range(sc, frextents, + &mp->m_free[FREE_RTEXTENTS], + fsc->frextents - fsc->frextents_delayed)) { + if (fsc->frozen) + xchk_set_corrupt(sc); + else + try_again = true; + } } if (try_again) diff --git a/fs/xfs/scrub/fscounters_repair.c b/fs/xfs/scrub/fscounters_repair.c index 08b6c7b5e1b7..e80d74f0c66f 100644 --- a/fs/xfs/scrub/fscounters_repair.c +++ b/fs/xfs/scrub/fscounters_repair.c @@ -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. */ - percpu_counter_set(&mp->m_free[FREE_RTEXTENTS], - fsc->frextents - fsc->frextents_delayed); - if (!xfs_has_rtgroups(mp)) - mp->m_sb.sb_frextents = fsc->frextents; + if (!xfs_has_zoned(mp)) { + percpu_counter_set(&mp->m_free[FREE_RTEXTENTS], + fsc->frextents - fsc->frextents_delayed); + if (!xfs_has_rtgroups(mp)) + mp->m_sb.sb_frextents = fsc->frextents; + } return 0; } -- 2.50.1