]> git.baikalelectronics.ru Git - kernel.git/commitdiff
expand those iov_iter_advance()...
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 11 Jun 2022 08:04:33 +0000 (04:04 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Aug 2022 02:37:25 +0000 (22:37 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
lib/iov_iter.c

index 415d51bbc727bd5d9c586f7a0c6c7c759f005d74..46ec07886d7b937ffa6b397380f6cb4a41aac84e 100644 (file)
@@ -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))