From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>,
Damien Le Moal <dlemoal@kernel.org>,
Hans Holmberg <hans.holmberg@wdc.com>,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/3] xfs: factor out a xfs_add_free_zone helper
Date: Tue, 9 Jun 2026 07:56:06 -0700 [thread overview]
Message-ID: <20260609145606.GB6078@frogsfrogsfrogs> (raw)
In-Reply-To: <20260609075655.1698743-2-hch@lst.de>
On Tue, Jun 09, 2026 at 09:56:41AM +0200, Christoph Hellwig wrote:
> 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>
I might've called this xfs_zone_mark_free but I don't care passionately
about the name.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_zone_alloc.c | 11 +++++++++--
> fs/xfs/xfs_zone_alloc.h | 1 +
> fs/xfs/xfs_zone_gc.c | 4 +---
> 3 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
> index 5e297b75a85f..0a7c4863eefb 100644
> --- a/fs/xfs/xfs_zone_alloc.c
> +++ b/fs/xfs/xfs_zone_alloc.c
> @@ -944,6 +944,14 @@ xfs_zone_rgbno_is_valid(
> rtg_rgno(rtg), XFS_RTG_FREE);
> }
>
> +void
> +xfs_add_free_zone(
> + 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_add_free_zone(rtg);
> iz->available += rtg_blocks(rtg);
> } else if (write_pointer < rtg_blocks(rtg)) {
> /* zone is open */
> diff --git a/fs/xfs/xfs_zone_alloc.h b/fs/xfs/xfs_zone_alloc.h
> index 8b2ef98c81ef..cc16cc328763 100644
> --- a/fs/xfs/xfs_zone_alloc.h
> +++ b/fs/xfs/xfs_zone_alloc.h
> @@ -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_add_free_zone(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);
> diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
> index f03211e4354a..670e05d2dadd 100644
> --- a/fs/xfs/xfs_zone_gc.c
> +++ b/fs/xfs/xfs_zone_gc.c
> @@ -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_add_free_zone(rtg);
> xfs_zoned_add_available(mp, rtg_blocks(rtg));
>
> wake_up_all(&zi->zi_zone_wait);
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-06-09 14:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 7:56 zoned growfs fix Christoph Hellwig
2026-06-09 7:56 ` [PATCH 1/3] xfs: factor out a xfs_add_free_zone helper Christoph Hellwig
2026-06-09 14:56 ` Darrick J. Wong [this message]
2026-06-09 23:17 ` Damien Le Moal
2026-06-09 7:56 ` [PATCH 2/3] xfs: account newly added RTGs as free zones in growfs Christoph Hellwig
2026-06-09 14:54 ` Darrick J. Wong
2026-06-09 23:18 ` Damien Le Moal
2026-06-09 7:56 ` [PATCH 3/3] xfs: only log freed extents for the current RTG in zoned growfs Christoph Hellwig
2026-06-09 14:54 ` Darrick J. Wong
2026-06-09 23:20 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260609145606.GB6078@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=dlemoal@kernel.org \
--cc=hans.holmberg@wdc.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox