linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Carlos Maiolino <cem@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	willy@infradead.org, dlemoal@kernel.org, hans.holmberg@wdc.com,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: set s_min_writeback_pages for zoned file systems
Date: Wed, 15 Oct 2025 09:01:58 -0700	[thread overview]
Message-ID: <20251015160158.GA6188@frogsfrogsfrogs> (raw)
In-Reply-To: <20251015062728.60104-4-hch@lst.de>

On Wed, Oct 15, 2025 at 03:27:16PM +0900, Christoph Hellwig wrote:
> Set s_min_writeback_pages to the zone size, so that writeback always
> writes up to a full zone.  This ensures that writeback does not add
> spurious file fragmentation when writing back a large number of
> files that are larger than the zone size.
> 
> Fixes: 4e4d52075577 ("xfs: add the zoned space allocator")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_zone_alloc.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
> index 1147bacb2da8..0f4e460fd3ea 100644
> --- a/fs/xfs/xfs_zone_alloc.c
> +++ b/fs/xfs/xfs_zone_alloc.c
> @@ -1215,6 +1215,7 @@ xfs_mount_zones(
>  		.mp		= mp,
>  	};
>  	struct xfs_buftarg	*bt = mp->m_rtdev_targp;
> +	xfs_extlen_t		zone_blocks = mp->m_groups[XG_TYPE_RTG].blocks;
>  	int			error;
>  
>  	if (!bt) {
> @@ -1245,10 +1246,12 @@ xfs_mount_zones(
>  		return -ENOMEM;
>  
>  	xfs_info(mp, "%u zones of %u blocks (%u max open zones)",
> -		 mp->m_sb.sb_rgcount, mp->m_groups[XG_TYPE_RTG].blocks,
> -		 mp->m_max_open_zones);
> +		 mp->m_sb.sb_rgcount, zone_blocks, mp->m_max_open_zones);
>  	trace_xfs_zones_mount(mp);
>  
> +	mp->m_super->s_min_writeback_pages =
> +		XFS_FSB_TO_B(mp, zone_blocks) >> PAGE_SHIFT;

Hmm.  The maximum rtgroup (and hence zone) size is 2^31-1 blocks.
That quantity is casted to int64_t by FSB_TO_B, then shifted down by
PAGE_SHIFT.  So I think there's no chance of an overflow here,
especially if s_min_writeback_pages becomes type long.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> +
>  	if (bdev_is_zoned(bt->bt_bdev)) {
>  		error = blkdev_report_zones(bt->bt_bdev,
>  				XFS_FSB_TO_BB(mp, mp->m_sb.sb_rtstart),
> -- 
> 2.47.3
> 
> 


  parent reply	other threads:[~2025-10-15 16:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  6:27 allow file systems to increase the minimum writeback chunk size Christoph Hellwig
2025-10-15  6:27 ` [PATCH 1/3] writeback: cleanup writeback_chunk_size Christoph Hellwig
2025-10-15  7:05   ` Damien Le Moal
2025-10-15 15:48   ` Darrick J. Wong
2025-10-20  9:34   ` Jan Kara
2025-10-15  6:27 ` [PATCH 2/3] writeback: allow the file system to override MIN_WRITEBACK_PAGES Christoph Hellwig
2025-10-15  7:09   ` Damien Le Moal
2025-10-15  7:27     ` Christoph Hellwig
2025-10-15 15:13   ` Theodore Ts'o
2025-10-16  4:33     ` Christoph Hellwig
2025-10-15 15:57   ` Darrick J. Wong
2025-10-16  4:37     ` Christoph Hellwig
2025-10-15 20:49   ` Dave Chinner
2025-10-16  4:39     ` Christoph Hellwig
2025-10-16  8:23       ` Dave Chinner
2025-10-15  6:27 ` [PATCH 3/3] xfs: set s_min_writeback_pages for zoned file systems Christoph Hellwig
2025-10-15  7:10   ` Damien Le Moal
2025-10-15 16:01   ` Darrick J. Wong [this message]
2025-10-15  7:11 ` allow file systems to increase the minimum writeback chunk size Damien Le Moal
2025-10-17  3:45 allow file systems to increase the minimum writeback chunk size v2 Christoph Hellwig
2025-10-17  3:45 ` [PATCH 3/3] xfs: set s_min_writeback_pages for zoned file systems Christoph Hellwig

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=20251015160158.GA6188@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=willy@infradead.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