Skip to content

Commit 89c6c1d

Browse files
zhangyi089brauner
authored andcommitted
iomap: drop the write failure handles when unsharing and zeroing
Unsharing and zeroing can only happen within EOF, so there is never a need to perform posteof pagecache truncation if write begin fails, also partial write could never theoretically happened from iomap_write_end(), so remove both of them. Signed-off-by: Zhang Yi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 0fac04e commit 89c6c1d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/iomap/buffered-io.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,6 @@ static int iomap_write_begin(struct iomap_iter *iter, loff_t pos,
824824

825825
out_unlock:
826826
__iomap_put_folio(iter, pos, 0, folio);
827-
iomap_write_failed(iter->inode, pos, len);
828827

829828
return status;
830829
}
@@ -901,8 +900,6 @@ static size_t iomap_write_end(struct iomap_iter *iter, loff_t pos, size_t len,
901900

902901
if (old_size < pos)
903902
pagecache_isize_extended(iter->inode, old_size, pos);
904-
if (ret < len)
905-
iomap_write_failed(iter->inode, pos + ret, len - ret);
906903
return ret;
907904
}
908905

@@ -950,8 +947,10 @@ static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i)
950947
}
951948

952949
status = iomap_write_begin(iter, pos, bytes, &folio);
953-
if (unlikely(status))
950+
if (unlikely(status)) {
951+
iomap_write_failed(iter->inode, pos, bytes);
954952
break;
953+
}
955954
if (iter->iomap.flags & IOMAP_F_STALE)
956955
break;
957956

@@ -965,6 +964,9 @@ static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i)
965964
copied = copy_folio_from_iter_atomic(folio, offset, bytes, i);
966965
status = iomap_write_end(iter, pos, bytes, copied, folio);
967966

967+
if (status < bytes)
968+
iomap_write_failed(iter->inode, pos + status,
969+
bytes - status);
968970
if (unlikely(copied != status))
969971
iov_iter_revert(i, copied - status);
970972

0 commit comments

Comments
 (0)