]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: factor out a xfs_zone_mark_free helper
authorChristoph Hellwig <hch@lst.de>
Wed, 10 Jun 2026 05:07:19 +0000 (07:07 +0200)
committerCarlos Maiolino <cem@kernel.org>
Wed, 10 Jun 2026 06:25:13 +0000 (08:25 +0200)
Add a helper for adding a zone to the free pool in preparation of adding
another caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_zone_alloc.c
fs/xfs/xfs_zone_alloc.h
fs/xfs/xfs_zone_gc.c

index 5e297b75a85f633f3c6b1a42795fbfa75ceae408..08d8b34f467e72c1c876ec164dc3d8c4cc31e22c 100644 (file)
@@ -944,6 +944,14 @@ xfs_zone_rgbno_is_valid(
                        rtg_rgno(rtg), XFS_RTG_FREE);
 }
 
+void
+xfs_zone_mark_free(
+       struct xfs_rtgroup      *rtg)
+{
+       xfs_group_set_mark(rtg_group(rtg), XFS_RTG_FREE);
+       atomic_inc(&rtg_mount(rtg)->m_zone_info->zi_nr_free_zones);
+}
+
 static void
 xfs_free_open_zones(
        struct xfs_zone_info    *zi)
@@ -1082,8 +1090,7 @@ xfs_init_zone(
 
        if (write_pointer == 0) {
                /* zone is empty */
-               atomic_inc(&zi->zi_nr_free_zones);
-               xfs_group_set_mark(rtg_group(rtg), XFS_RTG_FREE);
+               xfs_zone_mark_free(rtg);
                iz->available += rtg_blocks(rtg);
        } else if (write_pointer < rtg_blocks(rtg)) {
                /* zone is open */
index 8b2ef98c81eff830a9197301758b085c27933e32..abf8358bb2662e8bc305f9f0bcf0ed39662879fd 100644 (file)
@@ -42,6 +42,7 @@ void xfs_zoned_wake_all(struct xfs_mount *mp);
 bool xfs_zone_rgbno_is_valid(struct xfs_rtgroup *rtg, xfs_rgnumber_t rgbno);
 void xfs_mark_rtg_boundary(struct iomap_ioend *ioend);
 
+void xfs_zone_mark_free(struct xfs_rtgroup *rtg);
 uint64_t xfs_zoned_default_resblks(struct xfs_mount *mp,
                enum xfs_free_counter ctr);
 void xfs_zoned_show_stats(struct seq_file *m, struct xfs_mount *mp);
index f03211e4354adccb82aebb77e4f3a23cff047922..f76a091308528b3bf267195093672fed926f741e 100644 (file)
@@ -924,9 +924,7 @@ xfs_zone_gc_finish_reset(
                goto out;
        }
 
-       xfs_group_set_mark(rtg_group(rtg), XFS_RTG_FREE);
-       atomic_inc(&zi->zi_nr_free_zones);
-
+       xfs_zone_mark_free(rtg);
        xfs_zoned_add_available(mp, rtg_blocks(rtg));
 
        wake_up_all(&zi->zi_zone_wait);