[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aNWRKZJKePnNl2O3@bfoster>
Date: Thu, 25 Sep 2025 14:59:53 -0400
From: Brian Foster <bfoster@...hat.com>
To: alexjlzheng@...il.com
Cc: brauner@...nel.org, djwong@...nel.org, hch@...radead.org,
kernel@...kajraghav.com, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
yi.zhang@...wei.com, Jinliang Zheng <alexjlzheng@...cent.com>
Subject: Re: [PATCH v5 2/4] iomap: move iter revert case out of the unwritten
branch
On Tue, Sep 23, 2025 at 12:21:56PM +0800, alexjlzheng@...il.com wrote:
> From: Jinliang Zheng <alexjlzheng@...cent.com>
>
> The commit e1f453d4336d ("iomap: do some small logical cleanup in
> buffered write") merged iomap_write_failed() and iov_iter_revert()
> into the branch with written == 0. Because, at the time,
> iomap_write_end() could never return a partial write length.
>
> In the subsequent patch, iomap_write_end() will be modified to allow
> to return block-aligned partial write length (partial write length
> here is relative to the folio-sized write), which violated the above
> patch's assumption.
>
> This patch moves it back out to prepare for the subsequent patches.
>
> Signed-off-by: Jinliang Zheng <alexjlzheng@...cent.com>
> ---
Reviewed-by: Brian Foster <bfoster@...hat.com>
> fs/iomap/buffered-io.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index ee1b2cd8a4b4..e130db3b761e 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -1019,6 +1019,11 @@ static int iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i,
>
> if (old_size < pos)
> pagecache_isize_extended(iter->inode, old_size, pos);
> + if (written < bytes)
> + iomap_write_failed(iter->inode, pos + written,
> + bytes - written);
> + if (unlikely(copied != written))
> + iov_iter_revert(i, copied - written);
>
> cond_resched();
> if (unlikely(written == 0)) {
> @@ -1028,9 +1033,6 @@ static int iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i,
> * halfway through, might be a race with munmap,
> * might be severe memory pressure.
> */
> - iomap_write_failed(iter->inode, pos, bytes);
> - iov_iter_revert(i, copied);
> -
> if (chunk > PAGE_SIZE)
> chunk /= 2;
> if (copied) {
> --
> 2.49.0
>
>
Powered by blists - more mailing lists