diff mbox series

[4/9] block: use bio_release_pages in bio_map_user_iov

Message ID 20190626134928.7988-5-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/9] block: move the BIO_NO_PAGE_REF check into bio_release_pages | expand

Commit Message

Christoph Hellwig June 26, 2019, 1:49 p.m. UTC
Use bio_release_pages instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Minwoo Im June 26, 2019, 8:41 p.m. UTC | #1
This looks good to me.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Chaitanya Kulkarni June 26, 2019, 8:47 p.m. UTC | #2
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

On 06/26/2019 06:49 AM, Christoph Hellwig wrote:
> Use bio_release_pages instead of open coding it.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   block/bio.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 20a16347bcbb..a96d33d2de44 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -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);
>   }
>
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 20a16347bcbb..a96d33d2de44 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -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);
 }