]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: add an assert to xfs_zone_gc_select_target xfs-zoned-2025-02-06
authorChristoph Hellwig <hch@lst.de>
Fri, 31 Jan 2025 05:40:48 +0000 (06:40 +0100)
committerChristoph Hellwig <hch@lst.de>
Fri, 31 Jan 2025 08:36:57 +0000 (09:36 +0100)
To esure we catch any future messup where the open zones are not
properly accounted at mount time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_zone_gc.c

index 288f1b4f9708e2a410ee23931a724b9863b7ec27..4d893a40f345672098f193d1c859a77aa8406eea 100644 (file)
@@ -548,8 +548,9 @@ xfs_zone_gc_select_target(
        if (oz && oz->oz_written < rtg_blocks(oz->oz_rtg))
                return NULL;
 
+       ASSERT(zi->zi_nr_open_zones <=
+               mp->m_max_open_zones - XFS_OPEN_GC_ZONES);
        oz = xfs_open_zone(mp, WRITE_LIFE_NOT_SET, true);
-
        if (oz)
                trace_xfs_gc_zone_activate(oz->oz_rtg);
        spin_lock(&zi->zi_open_zones_lock);