public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>, Carlos Maiolino <cem@kernel.org>
Cc: Hans Holmberg <hans.holmberg@wdc.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/4] xfs: expose the number of open zones in sysfs
Date: Tue, 31 Mar 2026 18:35:31 +0900	[thread overview]
Message-ID: <c2d53f91-f0dc-4d11-b11b-28a9a2a48e4d@kernel.org> (raw)
In-Reply-To: <20260330054111.3855818-4-hch@lst.de>

On 3/30/26 14:40, Christoph Hellwig wrote:
> Add a sysfs attribute for the current number of open zones so that it
> can be trivially read from userspace in monitoring or testing software.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  Documentation/admin-guide/xfs.rst |  4 ++++
>  fs/xfs/xfs_sysfs.c                | 13 +++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/Documentation/admin-guide/xfs.rst b/Documentation/admin-guide/xfs.rst
> index 746ea60eed3f..eb3085421276 100644
> --- a/Documentation/admin-guide/xfs.rst
> +++ b/Documentation/admin-guide/xfs.rst
> @@ -550,6 +550,10 @@ For zoned file systems, the following attributes are exposed in:
>  	is limited by the capabilities of the backing zoned device, file system
>  	size and the max_open_zones mount option.
>  
> +  nr_open_zones			(Min:  1  Default:  Varies  Max:  UINTMAX)
> +	This read-only attribute exposes the current number of open zones
> +	used by the file system.
> +
>    zonegc_low_space		(Min:  0  Default:  0  Max:  100)
>  	Define a percentage for how much of the unused space that GC should keep
>  	available for writing. A high value will reclaim more of the space
> diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
> index 6c7909838234..43a02c622b6d 100644
> --- a/fs/xfs/xfs_sysfs.c
> +++ b/fs/xfs/xfs_sysfs.c
> @@ -13,6 +13,7 @@
>  #include "xfs_log.h"
>  #include "xfs_log_priv.h"
>  #include "xfs_mount.h"
> +#include "xfs_zone_priv.h"
>  #include "xfs_zones.h"
>  
>  struct xfs_sysfs_attr {
> @@ -718,6 +719,17 @@ max_open_zones_show(
>  }
>  XFS_SYSFS_ATTR_RO(max_open_zones);
>  
> +static ssize_t
> +nr_open_zones_show(
> +	struct kobject		*kobj,
> +	char			*buf)
> +{
> +	struct xfs_zone_info	*zi = zoned_to_mp(kobj)->m_zone_info;
> +
> +	return sysfs_emit(buf, "%u\n", zi->zi_nr_open_zones);

Since this is not an atomic, don't we need to copy this field into a local
variable under spin_lock(&zi->zi_open_zones_lock) ?


> +}
> +XFS_SYSFS_ATTR_RO(nr_open_zones);
> +
>  static ssize_t
>  zonegc_low_space_store(
>  	struct kobject		*kobj,
> @@ -751,6 +763,7 @@ XFS_SYSFS_ATTR_RW(zonegc_low_space);
>  
>  static struct attribute *xfs_zoned_attrs[] = {
>  	ATTR_LIST(max_open_zones),
> +	ATTR_LIST(nr_open_zones),
>  	ATTR_LIST(zonegc_low_space),
>  	NULL,
>  };


-- 
Damien Le Moal
Western Digital Research

  parent reply	other threads:[~2026-03-31  9:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30  5:40 fix handling of too many open zones at mount time Christoph Hellwig
2026-03-30  5:40 ` [PATCH 1/4] xfs: refactor xfs_mount_zones Christoph Hellwig
2026-03-31  7:12   ` Hans Holmberg
2026-03-31  9:21   ` Damien Le Moal
2026-03-30  5:40 ` [PATCH 2/4] xfs: handle too many open zones when mounting Christoph Hellwig
2026-03-31  7:34   ` Hans Holmberg
2026-03-31  9:30   ` Damien Le Moal
2026-03-30  5:40 ` [PATCH 3/4] xfs: expose the number of open zones in sysfs Christoph Hellwig
2026-03-31  7:39   ` Hans Holmberg
2026-03-31  9:35   ` Damien Le Moal [this message]
2026-03-30  5:41 ` [PATCH 4/4] xfs: untangle the open zones reporting in mountinfo Christoph Hellwig
2026-03-30  5:47   ` Christoph Hellwig
2026-03-30  9:55     ` Niklas Cassel
2026-03-30 13:10       ` Christoph Hellwig
2026-03-30 13:23     ` Carlos Maiolino
2026-03-31  7:41   ` Hans Holmberg
2026-03-31  9:36   ` 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=c2d53f91-f0dc-4d11-b11b-28a9a2a48e4d@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cem@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