bio_map_user_iov(): get rid of copying iov_iter

we do want *iter advanced

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2017-09-24 12:30:17 -04:00
parent 98a09d6106
commit 0a0f151364
1 changed files with 3 additions and 6 deletions

View File

@ -1333,7 +1333,6 @@ struct bio *bio_map_user_iov(struct request_queue *q,
int j; int j;
struct bio *bio; struct bio *bio;
int ret; int ret;
struct iov_iter i;
struct bio_vec *bvec; struct bio_vec *bvec;
if (!iov_iter_count(iter)) if (!iov_iter_count(iter))
@ -1343,14 +1342,13 @@ struct bio *bio_map_user_iov(struct request_queue *q,
if (!bio) if (!bio)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
i = *iter; while (iov_iter_count(iter)) {
while (iov_iter_count(&i)) {
struct page **pages; struct page **pages;
ssize_t bytes; ssize_t bytes;
size_t offs, added = 0; size_t offs, added = 0;
int npages; int npages;
bytes = iov_iter_get_pages_alloc(&i, &pages, LONG_MAX, &offs); bytes = iov_iter_get_pages_alloc(iter, &pages, LONG_MAX, &offs);
if (unlikely(bytes <= 0)) { if (unlikely(bytes <= 0)) {
ret = bytes ? bytes : -EFAULT; ret = bytes ? bytes : -EFAULT;
goto out_unmap; goto out_unmap;
@ -1384,7 +1382,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
bytes -= n; bytes -= n;
offs = 0; offs = 0;
} }
iov_iter_advance(&i, added); iov_iter_advance(iter, added);
} }
/* /*
* release the pages we didn't map into the bio, if any * release the pages we didn't map into the bio, if any
@ -1406,7 +1404,6 @@ struct bio *bio_map_user_iov(struct request_queue *q,
* reference to it * reference to it
*/ */
bio_get(bio); bio_get(bio);
iov_iter_advance(iter, bio->bi_iter.bi_size);
return bio; return bio;
out_unmap: out_unmap: