diff options
author | Christoph Hellwig <hch@lst.de> | 2015-01-18 10:16:29 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-02-05 11:30:37 -0500 |
commit | ddad8dd0a162fde61646a627a3017c258601dc8a (patch) | |
tree | 62a0c931c0efb7cd86457e1908ceb1655997c595 /block/bio.c | |
parent | 42d2683a2704ef4bbbb07fd0b9486ab312dd8c56 (diff) |
block: use blk_rq_map_user_iov to implement blk_rq_map_user
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/bio.c')
-rw-r--r-- | block/bio.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/block/bio.c b/block/bio.c index 54da51ed43de..879921e6b049 100644 --- a/block/bio.c +++ b/block/bio.c | |||
@@ -1102,7 +1102,7 @@ static int __bio_copy_iov(struct bio *bio, const struct sg_iovec *iov, int iov_c | |||
1102 | * bio_uncopy_user - finish previously mapped bio | 1102 | * bio_uncopy_user - finish previously mapped bio |
1103 | * @bio: bio being terminated | 1103 | * @bio: bio being terminated |
1104 | * | 1104 | * |
1105 | * Free pages allocated from bio_copy_user() and write back data | 1105 | * Free pages allocated from bio_copy_user_iov() and write back data |
1106 | * to user space in case of a read. | 1106 | * to user space in case of a read. |
1107 | */ | 1107 | */ |
1108 | int bio_uncopy_user(struct bio *bio) | 1108 | int bio_uncopy_user(struct bio *bio) |
@@ -1256,32 +1256,6 @@ out_bmd: | |||
1256 | return ERR_PTR(ret); | 1256 | return ERR_PTR(ret); |
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | /** | ||
1260 | * bio_copy_user - copy user data to bio | ||
1261 | * @q: destination block queue | ||
1262 | * @map_data: pointer to the rq_map_data holding pages (if necessary) | ||
1263 | * @uaddr: start of user address | ||
1264 | * @len: length in bytes | ||
1265 | * @write_to_vm: bool indicating writing to pages or not | ||
1266 | * @gfp_mask: memory allocation flags | ||
1267 | * | ||
1268 | * Prepares and returns a bio for indirect user io, bouncing data | ||
1269 | * to/from kernel pages as necessary. Must be paired with | ||
1270 | * call bio_uncopy_user() on io completion. | ||
1271 | */ | ||
1272 | struct bio *bio_copy_user(struct request_queue *q, struct rq_map_data *map_data, | ||
1273 | unsigned long uaddr, unsigned int len, | ||
1274 | int write_to_vm, gfp_t gfp_mask) | ||
1275 | { | ||
1276 | struct sg_iovec iov; | ||
1277 | |||
1278 | iov.iov_base = (void __user *)uaddr; | ||
1279 | iov.iov_len = len; | ||
1280 | |||
1281 | return bio_copy_user_iov(q, map_data, &iov, 1, write_to_vm, gfp_mask); | ||
1282 | } | ||
1283 | EXPORT_SYMBOL(bio_copy_user); | ||
1284 | |||
1285 | static struct bio *__bio_map_user_iov(struct request_queue *q, | 1259 | static struct bio *__bio_map_user_iov(struct request_queue *q, |
1286 | struct block_device *bdev, | 1260 | struct block_device *bdev, |
1287 | const struct sg_iovec *iov, int iov_count, | 1261 | const struct sg_iovec *iov, int iov_count, |
@@ -1395,31 +1369,6 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
1395 | } | 1369 | } |
1396 | 1370 | ||
1397 | /** | 1371 | /** |
1398 | * bio_map_user - map user address into bio | ||
1399 | * @q: the struct request_queue for the bio | ||
1400 | * @bdev: destination block device | ||
1401 | * @uaddr: start of user address | ||
1402 | * @len: length in bytes | ||
1403 | * @write_to_vm: bool indicating writing to pages or not | ||
1404 | * @gfp_mask: memory allocation flags | ||
1405 | * | ||
1406 | * Map the user space address into a bio suitable for io to a block | ||
1407 | * device. Returns an error pointer in case of error. | ||
1408 | */ | ||
1409 | struct bio *bio_map_user(struct request_queue *q, struct block_device *bdev, | ||
1410 | unsigned long uaddr, unsigned int len, int write_to_vm, | ||
1411 | gfp_t gfp_mask) | ||
1412 | { | ||
1413 | struct sg_iovec iov; | ||
1414 | |||
1415 | iov.iov_base = (void __user *)uaddr; | ||
1416 | iov.iov_len = len; | ||
1417 | |||
1418 | return bio_map_user_iov(q, bdev, &iov, 1, write_to_vm, gfp_mask); | ||
1419 | } | ||
1420 | EXPORT_SYMBOL(bio_map_user); | ||
1421 | |||
1422 | /** | ||
1423 | * bio_map_user_iov - map user sg_iovec table into bio | 1372 | * bio_map_user_iov - map user sg_iovec table into bio |
1424 | * @q: the struct request_queue for the bio | 1373 | * @q: the struct request_queue for the bio |
1425 | * @bdev: destination block device | 1374 | * @bdev: destination block device |