summaryrefslogtreecommitdiff
path: root/fs/iomap
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2021-04-30 17:26:41 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2021-06-10 18:45:14 +0300
commitf0b65f39ac505e8f1dcdaa165aa7b8c0bd6fd454 (patch)
tree05ad20f84ee097a534132fa9b2df9feae6d4a7d2 /fs/iomap
parente4f8df86798aea60aff6cfff40252b709431f850 (diff)
downloadlinux-f0b65f39ac505e8f1dcdaa165aa7b8c0bd6fd454.tar.xz
iov_iter: replace iov_iter_copy_from_user_atomic() with iterator-advancing variant
Replacement is called copy_page_from_iter_atomic(); unlike the old primitive the callers do *not* need to do iov_iter_advance() after it. In case when they end up consuming less than they'd been given they need to do iov_iter_revert() on everything they had not consumed. That, however, needs to be done only on slow paths. All in-tree callers converted. And that kills the last user of iterate_all_kinds() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/iomap')
-rw-r--r--fs/iomap/buffered-io.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 354b41d20e5d..c5ff13e0e7cf 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -785,13 +785,15 @@ again:
if (mapping_writably_mapped(inode->i_mapping))
flush_dcache_page(page);
- copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
+ copied = copy_page_from_iter_atomic(page, offset, bytes, i);
status = iomap_write_end(inode, pos, bytes, copied, page, iomap,
srcmap);
- cond_resched();
+ if (unlikely(copied != status))
+ iov_iter_revert(i, copied - status);
+ cond_resched();
if (unlikely(status == 0)) {
/*
* A short copy made iomap_write_end() reject the
@@ -803,11 +805,9 @@ again:
bytes = copied;
goto again;
}
- copied = status;
- iov_iter_advance(i, copied);
- pos += copied;
- written += copied;
- length -= copied;
+ pos += status;
+ written += status;
+ length -= status;
balance_dirty_pages_ratelimited(inode->i_mapping);
} while (iov_iter_count(i) && length);