Skip to content

Commit

Permalink
block: use bio_release_pages in bio_unmap_user
Browse files Browse the repository at this point in the history
Use bio_release_pages instead of open coding it.

Reviewed-by: Chaitanya Kulkarni <[email protected]>
Reviewed-by: Minwoo Im <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jun 29, 2019
1 parent d241a95 commit 163cc2d
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,24 +1437,6 @@ struct bio *bio_map_user_iov(struct request_queue *q,
return ERR_PTR(ret);
}

static void __bio_unmap_user(struct bio *bio)
{
struct bio_vec *bvec;
struct bvec_iter_all iter_all;

/*
* make sure we dirty pages we wrote to
*/
bio_for_each_segment_all(bvec, bio, iter_all) {
if (bio_data_dir(bio) == READ)
set_page_dirty_lock(bvec->bv_page);

put_page(bvec->bv_page);
}

bio_put(bio);
}

/**
* bio_unmap_user - unmap a bio
* @bio: the bio being unmapped
Expand All @@ -1466,7 +1448,8 @@ static void __bio_unmap_user(struct bio *bio)
*/
void bio_unmap_user(struct bio *bio)
{
__bio_unmap_user(bio);
bio_release_pages(bio, bio_data_dir(bio) == READ);
bio_put(bio);
bio_put(bio);
}

Expand Down

0 comments on commit 163cc2d

Please sign in to comment.