Commit d823dfc0 authored by Al Viro's avatar Al Viro Committed by Kleber Sacilotto de Souza

bio_copy_from_iter(): get rid of copying iov_iter

BugLink: http://bugs.launchpad.net/bugs/1834499

we want the one passed to it advanced, anyway
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
(cherry picked from commit 98a09d61)
Signed-off-by: default avatarMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Acked-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent fa69f8dc
...@@ -1022,7 +1022,7 @@ static struct bio_map_data *bio_alloc_map_data(unsigned int iov_count, ...@@ -1022,7 +1022,7 @@ static struct bio_map_data *bio_alloc_map_data(unsigned int iov_count,
* Copy all pages from iov_iter to bio. * Copy all pages from iov_iter to bio.
* Returns 0 on success, or error on failure. * 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; int i;
struct bio_vec *bvec; struct bio_vec *bvec;
...@@ -1033,9 +1033,9 @@ static int bio_copy_from_iter(struct bio *bio, struct iov_iter iter) ...@@ -1033,9 +1033,9 @@ static int bio_copy_from_iter(struct bio *bio, struct iov_iter iter)
ret = copy_page_from_iter(bvec->bv_page, ret = copy_page_from_iter(bvec->bv_page,
bvec->bv_offset, bvec->bv_offset,
bvec->bv_len, bvec->bv_len,
&iter); iter);
if (!iov_iter_count(&iter)) if (!iov_iter_count(iter))
break; break;
if (ret < bvec->bv_len) if (ret < bvec->bv_len)
...@@ -1234,9 +1234,11 @@ struct bio *bio_copy_user_iov(struct request_queue *q, ...@@ -1234,9 +1234,11 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
*/ */
if (((iter->type & WRITE) && (!map_data || !map_data->null_mapped)) || if (((iter->type & WRITE) && (!map_data || !map_data->null_mapped)) ||
(map_data && map_data->from_user)) { (map_data && map_data->from_user)) {
ret = bio_copy_from_iter(bio, *iter); ret = bio_copy_from_iter(bio, iter);
if (ret) if (ret)
goto cleanup; goto cleanup;
} else {
iov_iter_advance(iter, bio->bi_iter.bi_size);
} }
bio->bi_private = bmd; bio->bi_private = bmd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment