From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/9] xfs: split xfs_end_ioend_write
Date: Thu, 24 Sep 2026 13:26:37 -0700 [thread overview]
Message-ID: <20260924202637.GW2705364@frogsfrogsfrogs> (raw)
In-Reply-To: <20260924095740.2732474-8-hch@lst.de>
On Thu, Sep 24, 2026 at 11:57:08AM +0200, Christoph Hellwig wrote:
> Split out a separate helper for the zoned I/O completions as the code
> flow is pretty different already and will become even more so soon.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_ioend.c | 63 ++++++++++++++++++++++++++++------------------
> 1 file changed, 39 insertions(+), 24 deletions(-)
>
> diff --git a/fs/xfs/xfs_ioend.c b/fs/xfs/xfs_ioend.c
> index 258c6130bee8..f0e01ac34de8 100644
> --- a/fs/xfs/xfs_ioend.c
> +++ b/fs/xfs/xfs_ioend.c
> @@ -147,11 +147,40 @@ xfs_ioend_submit_read(
> }
>
> static void
> -xfs_ioend_put_open_zones(
> +xfs_end_ioend_write_zoned(
> struct iomap_ioend *ioend)
> {
> - struct iomap_ioend *tmp;
> + struct xfs_inode *ip = XFS_I(ioend->io_inode);
> + struct xfs_open_zone *oz = ioend->io_private;
> + struct iomap_ioend *tmp;
> + int error = -EIO;
> +
> + ASSERT(!(ioend->io_flags & IOMAP_IOEND_SHARED));
> +
> + if (xfs_is_shutdown(ip->i_mount))
> + goto done;
>
> + /*
> + * Zoned writes update the in-core open zone accounting before I/O
> + * submission. A failed write leaves that state inconsistent, so shut
> + * down the filesystem instead of letting later writers wait forever for
> + * open zone space to become available.
> + */
> + error = blk_status_to_errno(ioend->io_bio.bi_status);
> + if (unlikely(error)) {
> + xfs_force_shutdown(ip->i_mount, SHUTDOWN_META_IO_ERROR);
> + goto done;
> + }
> +
> + error = xfs_zoned_end_io(ip, ioend->io_offset, ioend->io_size,
> + ioend->io_sector, oz, NULLFSBLOCK);
> + if (error)
> + goto done;
> +
> + if (!(ioend->io_flags & IOMAP_IOEND_DIRECT) &&
> + xfs_ioend_is_append(ioend))
> + error = xfs_setfilesize(ip, ioend->io_offset, ioend->io_size);
> +done:
> /*
> * Put the open zone for all ioends merged into this one (if any).
> */
> @@ -162,8 +191,9 @@ xfs_ioend_put_open_zones(
> * The main ioend might not have an open zone if the submission failed
> * before xfs_zone_alloc_and_submit got called.
> */
> - if (ioend->io_private)
> - xfs_open_zone_put(ioend->io_private);
> + if (oz)
> + xfs_open_zone_put(oz);
> + iomap_finish_ioends(ioend, error);
> }
>
> static void
> @@ -172,7 +202,6 @@ xfs_end_ioend_write(
> {
> struct xfs_inode *ip = XFS_I(ioend->io_inode);
> struct xfs_mount *mp = ip->i_mount;
> - bool is_zoned = xfs_is_zoned_inode(ip);
> xfs_off_t offset = ioend->io_offset;
> size_t size = ioend->io_size;
> int error;
> @@ -194,19 +223,7 @@ xfs_end_ioend_write(
> */
> error = blk_status_to_errno(ioend->io_bio.bi_status);
> if (unlikely(error)) {
> - /*
> - * Zoned writes update the in-core open zone accounting before
> - * I/O submission. A failed write leaves that state
> - * inconsistent, so shut down the filesystem instead of letting
> - * later writers wait forever for open zone space to become
> - * available.
> - */
> - if (is_zoned) {
> - xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
> - goto done;
> - }
> if (ioend->io_flags & IOMAP_IOEND_SHARED) {
> - ASSERT(!is_zoned);
> xfs_reflink_cancel_cow_range(ip, offset, size, true);
> xfs_bmap_punch_delalloc_range(ip, XFS_DATA_FORK, offset,
> offset + size, NULL);
> @@ -217,10 +234,7 @@ xfs_end_ioend_write(
> /*
> * Success: commit the COW or unwritten blocks if needed.
> */
> - if (is_zoned)
> - error = xfs_zoned_end_io(ip, offset, size, ioend->io_sector,
> - ioend->io_private, NULLFSBLOCK);
> - else if (ioend->io_flags & IOMAP_IOEND_SHARED)
> + if (ioend->io_flags & IOMAP_IOEND_SHARED)
> error = xfs_reflink_end_cow(ip, offset, size);
> else if (ioend->io_flags & IOMAP_IOEND_UNWRITTEN)
> error = xfs_iomap_write_unwritten(ip, offset, size, false);
> @@ -230,8 +244,6 @@ xfs_end_ioend_write(
> xfs_ioend_is_append(ioend))
> error = xfs_setfilesize(ip, offset, size);
> done:
> - if (is_zoned)
> - xfs_ioend_put_open_zones(ioend);
> iomap_finish_ioends(ioend, error);
> }
>
> @@ -276,7 +288,10 @@ xfs_end_io(
> io_list))) {
> list_del_init(&ioend->io_list);
> iomap_ioend_try_merge(ioend, &tmp);
> - xfs_end_ioend_write(ioend);
> + if (xfs_is_zoned_inode(ip))
> + xfs_end_ioend_write_zoned(ioend);
> + else
> + xfs_end_ioend_write(ioend);
> cond_resched();
> }
> memalloc_nofs_restore(nofs_flag);
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-09-24 20:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 9:57 misc cleanups Christoph Hellwig
2026-09-24 9:57 ` [PATCH 1/9] xfs: centralize setting of buf_ops/buf_type/magic for rtblocks Christoph Hellwig
2026-09-24 19:01 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 2/9] xfs: factor out a xfs_rtfile_initialize_buf helper Christoph Hellwig
2026-09-24 19:02 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 3/9] xfs: add a xfs_rtblock_payload helper Christoph Hellwig
2026-09-24 20:13 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 4/9] xfs: cleanup xfs_verify_media_error Christoph Hellwig
2026-09-24 20:14 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 5/9] xfs: use bdev_rw_virt in xfs_verify_media Christoph Hellwig
2026-09-24 20:18 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 6/9] xfs: lift setting the NOFS context to xfs_end_io Christoph Hellwig
2026-09-24 20:18 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 7/9] xfs: split xfs_end_ioend_write Christoph Hellwig
2026-09-24 20:26 ` Darrick J. Wong [this message]
2026-09-25 5:46 ` Christoph Hellwig
2026-09-24 9:57 ` [PATCH 8/9] xfs: factor out a xfs_zoned_fill_srcmap helper Christoph Hellwig
2026-09-24 20:27 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 9/9] xfs: calculate end_fsb later in xfs_zoned_fill_srcmap Christoph Hellwig
2026-09-24 20:29 ` Darrick J. Wong
2026-10-05 18:06 ` misc cleanups Carlos Maiolino
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=20260924202637.GW2705364@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--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