public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>,
	Hans Holmberg <hans.holmberg@wdc.com>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 10/10] xfs: add sysfs stats for zoned GC
Date: Tue, 27 Jan 2026 17:40:44 -0800	[thread overview]
Message-ID: <20260128014044.GJ5945@frogsfrogsfrogs> (raw)
In-Reply-To: <20260127160619.330250-11-hch@lst.de>

On Tue, Jan 27, 2026 at 05:05:50PM +0100, Christoph Hellwig wrote:
> Add counters of read, write and zone_reset operations as well as
> GC written bytes to sysfs.  This way they can be easily used for
> monitoring tools and test cases.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

+1 for observability
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_stats.c   | 7 ++++++-
>  fs/xfs/xfs_stats.h   | 6 ++++++
>  fs/xfs/xfs_zone_gc.c | 7 +++++++
>  3 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> index 9781222e0653..6d7f98afa31a 100644
> --- a/fs/xfs/xfs_stats.c
> +++ b/fs/xfs/xfs_stats.c
> @@ -24,6 +24,7 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
>  	uint64_t	xs_write_bytes = 0;
>  	uint64_t	xs_read_bytes = 0;
>  	uint64_t	defer_relog = 0;
> +	uint64_t	xs_gc_write_bytes = 0;
>  
>  	static const struct xstats_entry {
>  		char	*desc;
> @@ -57,7 +58,8 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
>  		{ "rtrmapbt_mem",	xfsstats_offset(xs_rtrefcbt_2)	},
>  		{ "rtrefcntbt",		xfsstats_offset(xs_qm_dqreclaims)},
>  		/* we print both series of quota information together */
> -		{ "qm",			xfsstats_offset(xs_xstrat_bytes)},
> +		{ "qm",			xfsstats_offset(xs_gc_read_calls)},
> +		{ "zoned",		xfsstats_offset(__pad1)},
>  	};
>  
>  	/* Loop over all stats groups */
> @@ -77,6 +79,7 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
>  		xs_write_bytes += per_cpu_ptr(stats, i)->s.xs_write_bytes;
>  		xs_read_bytes += per_cpu_ptr(stats, i)->s.xs_read_bytes;
>  		defer_relog += per_cpu_ptr(stats, i)->s.defer_relog;
> +		xs_gc_write_bytes += per_cpu_ptr(stats, i)->s.xs_read_bytes;
>  	}
>  
>  	len += scnprintf(buf + len, PATH_MAX-len, "xpc %llu %llu %llu\n",
> @@ -89,6 +92,8 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
>  #else
>  		0);
>  #endif
> +	len += scnprintf(buf + len, PATH_MAX-len, "gc xpc %llu\n",
> +			xs_gc_write_bytes);
>  
>  	return len;
>  }
> diff --git a/fs/xfs/xfs_stats.h b/fs/xfs/xfs_stats.h
> index 15ba1abcf253..16dbbc0b72db 100644
> --- a/fs/xfs/xfs_stats.h
> +++ b/fs/xfs/xfs_stats.h
> @@ -138,10 +138,16 @@ struct __xfsstats {
>  	uint32_t		xs_qm_dqwants;
>  	uint32_t		xs_qm_dquot;
>  	uint32_t		xs_qm_dquot_unused;
> +/* Zone GC counters */
> +	uint32_t		xs_gc_read_calls;
> +	uint32_t		xs_gc_write_calls;
> +	uint32_t		xs_gc_zone_reset_calls;
> +	uint32_t		__pad1;
>  /* Extra precision counters */
>  	uint64_t		xs_xstrat_bytes;
>  	uint64_t		xs_write_bytes;
>  	uint64_t		xs_read_bytes;
> +	uint64_t		xs_gc_write_bytes;
>  	uint64_t		defer_relog;
>  };
>  
> diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
> index 570102184904..4bb647d3be41 100644
> --- a/fs/xfs/xfs_zone_gc.c
> +++ b/fs/xfs/xfs_zone_gc.c
> @@ -712,6 +712,8 @@ xfs_zone_gc_start_chunk(
>  	data->scratch_head = (data->scratch_head + len) % data->scratch_size;
>  	data->scratch_available -= len;
>  
> +	XFS_STATS_INC(mp, xs_gc_read_calls);
> +
>  	WRITE_ONCE(chunk->state, XFS_GC_BIO_NEW);
>  	list_add_tail(&chunk->entry, &data->reading);
>  	xfs_zone_gc_iter_advance(iter, irec.rm_blockcount);
> @@ -815,6 +817,9 @@ xfs_zone_gc_write_chunk(
>  		return;
>  	}
>  
> +	XFS_STATS_INC(mp, xs_gc_write_calls);
> +	XFS_STATS_ADD(mp, xs_gc_write_bytes, chunk->len);
> +
>  	WRITE_ONCE(chunk->state, XFS_GC_BIO_NEW);
>  	list_move_tail(&chunk->entry, &data->writing);
>  
> @@ -911,6 +916,8 @@ xfs_submit_zone_reset_bio(
>  		return;
>  	}
>  
> +	XFS_STATS_INC(mp, xs_gc_zone_reset_calls);
> +
>  	bio->bi_iter.bi_sector = xfs_gbno_to_daddr(&rtg->rtg_group, 0);
>  	if (!bdev_zone_is_seq(bio->bi_bdev, bio->bi_iter.bi_sector)) {
>  		/*
> -- 
> 2.47.3
> 
> 

  reply	other threads:[~2026-01-28  1:40 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27 16:05 stats and error injection for zoned GC Christoph Hellwig
2026-01-27 16:05 ` [PATCH 01/10] xfs: fix the errno sign for the xfs_errortag_{add,clearall} stubs Christoph Hellwig
2026-01-28  1:31   ` Darrick J. Wong
2026-01-28 10:50   ` Carlos Maiolino
2026-01-28 12:12   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 02/10] xfs: allocate m_errortag early Christoph Hellwig
2026-01-28  1:32   ` Darrick J. Wong
2026-01-28  3:42     ` Christoph Hellwig
2026-01-28 11:02   ` Carlos Maiolino
2026-01-28 12:12   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 03/10] xfs: don't validate error tags in the I/O path Christoph Hellwig
2026-01-28  1:33   ` Darrick J. Wong
2026-01-28 11:08   ` Carlos Maiolino
2026-01-28 12:14   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 04/10] xfs: move the guts of XFS_ERRORTAG_DELAY out of line Christoph Hellwig
2026-01-28  1:35   ` Darrick J. Wong
2026-01-28  3:44     ` Christoph Hellwig
2026-01-28  5:02       ` Darrick J. Wong
2026-01-28  5:03         ` Christoph Hellwig
2026-01-28 11:18     ` Carlos Maiolino
2026-01-28 14:10       ` Christoph Hellwig
2026-01-28 16:09         ` Darrick J. Wong
2026-01-28 17:43           ` Carlos Maiolino
2026-01-28 11:13   ` Carlos Maiolino
2026-01-28 12:14   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 05/10] xfs: use WRITE_ONCE/READ_ONCE for m_errortag Christoph Hellwig
2026-01-28  1:36   ` Darrick J. Wong
2026-01-28 11:21   ` Carlos Maiolino
2026-01-28 12:15   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 06/10] xfs: allow setting errortags at mount time Christoph Hellwig
2026-01-28  1:37   ` Darrick J. Wong
2026-01-28  3:45     ` Christoph Hellwig
2026-01-28  5:07       ` Darrick J. Wong
2026-01-28  5:12         ` Christoph Hellwig
2026-01-28 11:30   ` Carlos Maiolino
2026-01-28 14:11     ` Christoph Hellwig
2026-01-28 16:11     ` Darrick J. Wong
2026-01-28 16:13       ` Christoph Hellwig
2026-01-28 16:16         ` Darrick J. Wong
2026-01-28 17:48           ` Carlos Maiolino
2026-01-28 12:15   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 07/10] xfs: don't mark all discard issued by zoned GC as sync Christoph Hellwig
2026-01-28  1:38   ` Darrick J. Wong
2026-01-28  3:47     ` Christoph Hellwig
2026-01-28 11:30   ` Carlos Maiolino
2026-01-28 12:15   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 08/10] xfs: refactor zone reset handling Christoph Hellwig
2026-01-28  1:39   ` Darrick J. Wong
2026-01-28 11:34   ` Carlos Maiolino
2026-01-28 12:16   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 09/10] xfs: add zone reset error injection Christoph Hellwig
2026-01-28  1:39   ` Darrick J. Wong
2026-01-28 11:35   ` Carlos Maiolino
2026-01-28 12:19   ` Hans Holmberg
2026-01-27 16:05 ` [PATCH 10/10] xfs: add sysfs stats for zoned GC Christoph Hellwig
2026-01-28  1:40   ` Darrick J. Wong [this message]
2026-01-28 11:37   ` Carlos Maiolino
2026-01-28 12:53   ` Hans Holmberg
2026-01-28 14:12     ` hch
2026-01-28 15:11       ` Hans Holmberg
2026-01-28 15:12         ` hch

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=20260128014044.GJ5945@frogsfrogsfrogs \
    --to=djwong@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