summaryrefslogtreecommitdiff
path: root/lib/iov_iter.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2021-05-05 00:50:07 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2021-06-10 18:45:21 +0300
commit4b179e9a9c7c98550747b76405626dd59968f078 (patch)
tree4aef8b6c1ee1ad2afe07316656eb399a2e2b8fda /lib/iov_iter.c
parenta6e4ec7bfd32f42ff37577c6b708153d19880b6e (diff)
downloadlinux-4b179e9a9c7c98550747b76405626dd59968f078.tar.xz
iterate_xarray(): only of the first iteration we might get offset != 0
recalculating offset on each iteration is pointless - on all subsequent passes through the loop it will be zero anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'lib/iov_iter.c')
-rw-r--r--lib/iov_iter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 48a55de2a172..d5f750cc6f4a 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -70,9 +70,9 @@
__label__ __out; \
size_t __off = 0; \
struct page *head = NULL; \
- size_t offset; \
loff_t start = i->xarray_start + i->iov_offset; \
- pgoff_t index = start >> PAGE_SHIFT; \
+ unsigned offset = start % PAGE_SIZE; \
+ pgoff_t index = start / PAGE_SIZE; \
int j; \
\
XA_STATE(xas, i->xarray, index); \
@@ -89,7 +89,6 @@
for (j = (head->index < index) ? index - head->index : 0; \
j < thp_nr_pages(head); j++) { \
void *kaddr = kmap_local_page(head + j); \
- offset = (start + __off) % PAGE_SIZE; \
base = kaddr + offset; \
len = PAGE_SIZE - offset; \
len = min(n, len); \
@@ -100,6 +99,7 @@
n -= len; \
if (left || n == 0) \
goto __out; \
+ offset = 0; \
} \
} \
__out: \