]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ITER_XARRAY: don't open-code DIV_ROUND_UP()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 11 Jun 2022 00:30:35 +0000 (20:30 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Aug 2022 02:37:21 +0000 (22:37 -0400)
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
lib/iov_iter.c

index 8c6cdc1cf832be804b470c6bb07287e716df8dae..c78129e709f20d02be78ce858ebde5c9b02cf305 100644 (file)
@@ -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;