diff options
author | Christoph Hellwig <hch@lst.de> | 2015-01-18 18:16:33 +0300 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-02-05 19:30:43 +0300 |
commit | 37f19e57a0de3c4a3417aa13ff4d04f1e0dee4b3 (patch) | |
tree | 07851f8df6b3f2c568a557dab978901dc4129a0c /block | |
parent | 75c72b8366f35f2e5cf1b841b52095948878b794 (diff) | |
download | linux-37f19e57a0de3c4a3417aa13ff4d04f1e0dee4b3.tar.xz |
block: merge __bio_map_user_iov into bio_map_user_iov
And also remove the unused bdev argument.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/bio.c | 56 | ||||
-rw-r--r-- | block/blk-map.c | 2 |
2 files changed, 21 insertions, 37 deletions
diff --git a/block/bio.c b/block/bio.c index a69a9c9e7c93..0723d4ce8589 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1244,10 +1244,18 @@ out_bmd: return ERR_PTR(ret); } -static struct bio *__bio_map_user_iov(struct request_queue *q, - struct block_device *bdev, - const struct iov_iter *iter, - gfp_t gfp_mask) +/** + * bio_map_user_iov - map user iovec into bio + * @q: the struct request_queue for the bio + * @iter: iovec iterator + * @gfp_mask: memory allocation flags + * + * Map the user space address into a bio suitable for io to a block + * device. Returns an error pointer in case of error. + */ +struct bio *bio_map_user_iov(struct request_queue *q, + const struct iov_iter *iter, + gfp_t gfp_mask) { int j; int nr_pages = 0; @@ -1343,8 +1351,15 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, if (iter->type & WRITE) bio->bi_rw |= REQ_WRITE; - bio->bi_bdev = bdev; bio->bi_flags |= (1 << BIO_USER_MAPPED); + + /* + * subtle -- if __bio_map_user() ended up bouncing a bio, + * it would normally disappear when its bi_end_io is run. + * however, we need it for the unmap, so grab an extra + * reference to it + */ + bio_get(bio); return bio; out_unmap: @@ -1359,37 +1374,6 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, return ERR_PTR(ret); } -/** - * bio_map_user_iov - map user iovec into bio - * @q: the struct request_queue for the bio - * @bdev: destination block device - * @iter: iovec iterator - * @gfp_mask: memory allocation flags - * - * Map the user space address into a bio suitable for io to a block - * device. Returns an error pointer in case of error. - */ -struct bio *bio_map_user_iov(struct request_queue *q, struct block_device *bdev, - const struct iov_iter *iter, - gfp_t gfp_mask) -{ - struct bio *bio; - - bio = __bio_map_user_iov(q, bdev, iter, gfp_mask); - if (IS_ERR(bio)) - return bio; - - /* - * subtle -- if __bio_map_user() ended up bouncing a bio, - * it would normally disappear when its bi_end_io is run. - * however, we need it for the unmap, so grab an extra - * reference to it - */ - bio_get(bio); - - return bio; -} - static void __bio_unmap_user(struct bio *bio) { struct bio_vec *bvec; diff --git a/block/blk-map.c b/block/blk-map.c index 30e6bb871c5c..0f22911f17dc 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -88,7 +88,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, if (unaligned || (q->dma_pad_mask & iter->count) || map_data) bio = bio_copy_user_iov(q, map_data, iter, gfp_mask); else - bio = bio_map_user_iov(q, NULL, iter, gfp_mask); + bio = bio_map_user_iov(q, iter, gfp_mask); if (IS_ERR(bio)) return PTR_ERR(bio); |