diff options
author | Zhang Yi <yi.zhang@huawei.com> | 2024-03-20 14:05:48 +0300 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-04-25 15:23:54 +0300 |
commit | e1f453d4336d5d7fbbd1910532201b4a07a20a5c (patch) | |
tree | 721e2ddfe5241417bfadf5794cf42c37b66f1701 /fs/iomap | |
parent | 815f4b633ba1c9c6a151f251616f23e2407fcf24 (diff) | |
download | linux-e1f453d4336d5d7fbbd1910532201b4a07a20a5c.tar.xz |
iomap: do some small logical cleanup in buffered write
Since iomap_write_end() can never return a partial write length, the
comparison between written, copied and bytes becomes useless, just
merge them with the unwritten branch.
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://lore.kernel.org/r/20240320110548.2200662-10-yi.zhang@huaweicloud.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/iomap')
-rw-r--r-- | fs/iomap/buffered-io.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 73241fbaff6b..41c8f0c68ef5 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -975,11 +975,6 @@ retry: 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)) { @@ -989,6 +984,9 @@ retry: * 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) { |