public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>, Carlos Maiolino <cem@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
	Hans Holmberg <hans.holmberg@wdc.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: expose the current zonegc required status in sysfs
Date: Mon, 20 Apr 2026 17:47:55 +0200	[thread overview]
Message-ID: <41e7ced6-90c0-423a-9a90-4bfa263bdb31@kernel.org> (raw)
In-Reply-To: <20260420135011.624587-6-cassel@kernel.org>

On 2026/04/20 15:50, Niklas Cassel wrote:
> The current zonegc required status is currently available in
> /proc/<pid>/mountstats (which contains stats for all mounted zoned XFS
> filesystems), under "RT GC required:".
> 
> Add a sysfs attribute /sys/fs/xfs/<dev>/zoned/zonegc_required for the same.
> This makes it trivial for monitoring software to read the value, for a
> specific filesystem, without any complex parsing.
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

As is, I think this is OK, but I wonder if we should not instead call the
attribute zonegc_running and use xfs_is_zonegc_running() to test the
XFS_OPSTATE_ZONEGC_RUNNING flag for the attribute value ?

The reasoning here is that the GC thread also does zone reset for zones with all
blocks invalidated, and in such case we may start the GC thread even when
xfs_zoned_need_gc() is false.

And I think it is more interesting to see if the GC thread is running, so doing IOs.

Thoughts ?

> ---
>  Documentation/admin-guide/xfs.rst |  4 ++++
>  fs/xfs/xfs_sysfs.c                | 11 +++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/Documentation/admin-guide/xfs.rst b/Documentation/admin-guide/xfs.rst
> index be0d3f5e8b4c4..87ead41aa86c4 100644
> --- a/Documentation/admin-guide/xfs.rst
> +++ b/Documentation/admin-guide/xfs.rst
> @@ -565,3 +565,7 @@ For zoned file systems, the following attributes are exposed in:
>  	bursts at the cost of increased write amplification.  Regardless
>  	of this value, garbage collection will always aim to free a minimum
>  	amount of blocks to keep max_open_zones open for data placement purposes.
> +
> +  zonegc_required		(Min:  0  Default:  Varies  Max:  1)
> +	This read-only attribute exposes if GC is currently required by the file
> +	system.
> diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
> index 312bae4cf70fd..1e1ee020df001 100644
> --- a/fs/xfs/xfs_sysfs.c
> +++ b/fs/xfs/xfs_sysfs.c
> @@ -777,11 +777,22 @@ zonegc_low_space_show(
>  }
>  XFS_SYSFS_ATTR_RW(zonegc_low_space);
>  
> +static ssize_t
> +zonegc_required_show(
> +	struct kobject		*kobj,
> +	char			*buf)
> +{
> +	return sysfs_emit(buf, "%d\n",
> +			xfs_zoned_need_gc(zoned_to_mp(kobj)));
> +}
> +XFS_SYSFS_ATTR_RO(zonegc_required);
> +
>  static struct attribute *xfs_zoned_attrs[] = {
>  	ATTR_LIST(max_open_zones),
>  	ATTR_LIST(nr_free_zones),
>  	ATTR_LIST(nr_open_zones),
>  	ATTR_LIST(zonegc_low_space),
> +	ATTR_LIST(zonegc_required),
>  	NULL,
>  };
>  ATTRIBUTE_GROUPS(xfs_zoned);


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-04-20 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 13:50 [PATCH 0/2] xfs: add additional zoned sysfs attributes Niklas Cassel
2026-04-20 13:50 ` [PATCH 1/2] xfs: expose the number of free zones in sysfs Niklas Cassel
2026-04-20 15:39   ` Damien Le Moal
2026-04-20 13:50 ` [PATCH 2/2] xfs: expose the current zonegc required status " Niklas Cassel
2026-04-20 15:47   ` Damien Le Moal [this message]
2026-04-20 16:09     ` Niklas Cassel

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=41e7ced6-90c0-423a-9a90-4bfa263bdb31@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cassel@kernel.org \
    --cc=cem@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=hch@lst.de \
    --cc=johannes.thumshirn@wdc.com \
    --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