summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-09-24 12:14:36 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-10-11 17:23:41 -0400
commit98a09d6106660ec6e69ff2a6fa14039bd504412b (patch)
tree6236e7f0d34aa6559f26ee4eb18d6e7dff922af2 /block
parent2884d0be878eb5cbbc6d983c6054feef3b9aa86d (diff)
downloadlinux-98a09d6106660ec6e69ff2a6fa14039bd504412b.tar.gz
linux-98a09d6106660ec6e69ff2a6fa14039bd504412b.tar.bz2
linux-98a09d6106660ec6e69ff2a6fa14039bd504412b.zip
bio_copy_from_iter(): get rid of copying iov_iter
we want the one passed to it advanced, anyway Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block')
-rw-r--r--block/bio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/block/bio.c b/block/bio.c
index 02457c2d4379..f5002b44c963 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1088,7 +1088,7 @@ static struct bio_map_data *bio_alloc_map_data(unsigned int iov_count,
* Copy all pages from iov_iter to bio.
* Returns 0 on success, or error on failure.
*/
-static int bio_copy_from_iter(struct bio *bio, struct iov_iter iter)
+static int bio_copy_from_iter(struct bio *bio, struct iov_iter *iter)
{
int i;
struct bio_vec *bvec;
@@ -1099,9 +1099,9 @@ static int bio_copy_from_iter(struct bio *bio, struct iov_iter iter)
ret = copy_page_from_iter(bvec->bv_page,
bvec->bv_offset,
bvec->bv_len,
- &iter);
+ iter);
- if (!iov_iter_count(&iter))
+ if (!iov_iter_count(iter))
break;
if (ret < bvec->bv_len)
@@ -1297,11 +1297,12 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
*/
if (((iter->type & WRITE) && (!map_data || !map_data->null_mapped)) ||
(map_data && map_data->from_user)) {
- ret = bio_copy_from_iter(bio, *iter);
+ ret = bio_copy_from_iter(bio, iter);
if (ret)
goto cleanup;
+ } else {
+ iov_iter_advance(iter, bio->bi_iter.bi_size);
}
- iov_iter_advance(iter, bio->bi_iter.bi_size);
bio->bi_private = bmd;
if (map_data && map_data->null_mapped)