summaryrefslogtreecommitdiff
path: root/lib/iov_iter.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2022-06-10 20:30:35 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2022-08-08 22:37:21 -0400
commit0aa4fc32f54028f6fbb35bf71df4b0d86ff1662b (patch)
treee66c95705f27c5f7d524113d9e0f8cf24d75575b /lib/iov_iter.c
parent451c0ba9475ebdce36249c5c769efa5d580d1d83 (diff)
downloadlinux-rpi-0aa4fc32f54028f6fbb35bf71df4b0d86ff1662b.tar.gz
linux-rpi-0aa4fc32f54028f6fbb35bf71df4b0d86ff1662b.tar.bz2
linux-rpi-0aa4fc32f54028f6fbb35bf71df4b0d86ff1662b.zip
ITER_XARRAY: don't open-code DIV_ROUND_UP()
Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'lib/iov_iter.c')
-rw-r--r--lib/iov_iter.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 8c6cdc1cf832..c78129e709f2 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1386,15 +1386,7 @@ static ssize_t iter_xarray_get_pages(struct iov_iter *i,
offset = pos & ~PAGE_MASK;
*_start_offset = offset;
- count = 1;
- if (size > PAGE_SIZE - offset) {
- size -= PAGE_SIZE - offset;
- count += size >> PAGE_SHIFT;
- size &= ~PAGE_MASK;
- if (size)
- count++;
- }
-
+ count = DIV_ROUND_UP(size + offset, PAGE_SIZE);
if (count > maxpages)
count = maxpages;