block: use bio_release_pages in bio_map_user_iov
authorChristoph Hellwig <hch@lst.de>
Wed, 26 Jun 2019 13:49:23 +0000 (15:49 +0200)
committerJens Axboe <axboe@kernel.dk>
Sat, 29 Jun 2019 15:47:31 +0000 (09:47 -0600)
Use bio_release_pages instead of open coding it.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c

index c759f55985139da70dfff1f3da74efa20956de16..1cbf2a7c245e8f5723243ef3878f914416d36893 100644 (file)
@@ -1362,8 +1362,6 @@ struct bio *bio_map_user_iov(struct request_queue *q,
        int j;
        struct bio *bio;
        int ret;
-       struct bio_vec *bvec;
-       struct bvec_iter_all iter_all;
 
        if (!iov_iter_count(iter))
                return ERR_PTR(-EINVAL);
@@ -1430,9 +1428,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
        return bio;
 
  out_unmap:
-       bio_for_each_segment_all(bvec, bio, iter_all) {
-               put_page(bvec->bv_page);
-       }
+       bio_release_pages(bio, false);
        bio_put(bio);
        return ERR_PTR(ret);
 }