diff mbox series

[x,1/3] bio_copy_from_iter(): get rid of copying iov_iter

Message ID 20190627181657.17808-2-marcelo.cerri@canonical.com
State New
Headers show
Series LP: #1834499 - Block Layer Commits Requested in Azure Kernels (for the *generic* kernels) | expand

Commit Message

Marcelo Henrique Cerri June 27, 2019, 6:16 p.m. UTC
From: Al Viro <viro@zeniv.linux.org.uk>

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

we want the one passed to it advanced, anyway

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
(cherry picked from commit 98a09d6106660ec6e69ff2a6fa14039bd504412b)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
---

NOTE: This commit is only needed for xenial 4.4.

---
 block/bio.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 58921797f2e6..2b0c3c08c0b2 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -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.
  * 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;
@@ -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,
 					  bvec->bv_offset,
 					  bvec->bv_len,
-					  &iter);
+					  iter);
 
-		if (!iov_iter_count(&iter))
+		if (!iov_iter_count(iter))
 			break;
 
 		if (ret < bvec->bv_len)
@@ -1234,9 +1234,11 @@  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);
 	}
 
 	bio->bi_private = bmd;