summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2022-06-11 04:04:33 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2022-08-08 22:37:25 -0400
commit310d9d5a5009a93377200b98daa2d84aa2bd8160 (patch)
treef432bc8151ff874d2654b0f0b816f44c02a71f05 /lib
parent746de1f86fcd33464acac047f111eea877f2f7a0 (diff)
downloadlwn-310d9d5a5009a93377200b98daa2d84aa2bd8160.tar.gz
lwn-310d9d5a5009a93377200b98daa2d84aa2bd8160.zip
expand those iov_iter_advance()...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/iov_iter.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 415d51bbc727..46ec07886d7b 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1378,7 +1378,8 @@ static ssize_t iter_xarray_get_pages(struct iov_iter *i,
return 0;
maxsize = min_t(size_t, nr * PAGE_SIZE - offset, maxsize);
- iov_iter_advance(i, maxsize);
+ i->iov_offset += maxsize;
+ i->count -= maxsize;
return maxsize;
}
@@ -1467,7 +1468,13 @@ static ssize_t __iov_iter_get_pages_alloc(struct iov_iter *i,
for (int k = 0; k < n; k++)
get_page(p[k] = page + k);
maxsize = min_t(size_t, maxsize, n * PAGE_SIZE - *start);
- iov_iter_advance(i, maxsize);
+ i->count -= maxsize;
+ i->iov_offset += maxsize;
+ if (i->iov_offset == i->bvec->bv_len) {
+ i->iov_offset = 0;
+ i->bvec++;
+ i->nr_segs--;
+ }
return maxsize;
}
if (iov_iter_is_pipe(i))