diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-08-28 03:17:06 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:10 -0400 |
commit | 152e283fdfea0cd11e297d982378b55937842dde (patch) | |
tree | a97a57108353f167a1e2911e8ee09c527ef42d3e /include | |
parent | a3bce90edd8f6cafe3f63b1a943800792e830178 (diff) |
block: introduce struct rq_map_data to use reserved pages
This patch introduces struct rq_map_data to enable bio_copy_use_iov()
use reserved pages.
Currently, bio_copy_user_iov allocates bounce pages but
drivers/scsi/sg.c wants to allocate pages by itself and use
them. struct rq_map_data can be used to pass allocated pages to
bio_copy_user_iov.
The current users of bio_copy_user_iov simply passes NULL (they don't
want to use pre-allocated pages).
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Douglas Gilbert <dougg@torque.net>
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bio.h | 8 | ||||
-rw-r--r-- | include/linux/blkdev.h | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 200b185c3e83..bc386cd5e996 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -327,6 +327,7 @@ extern int bio_get_nr_vecs(struct block_device *); | |||
327 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, | 327 | extern struct bio *bio_map_user(struct request_queue *, struct block_device *, |
328 | unsigned long, unsigned int, int, gfp_t); | 328 | unsigned long, unsigned int, int, gfp_t); |
329 | struct sg_iovec; | 329 | struct sg_iovec; |
330 | struct rq_map_data; | ||
330 | extern struct bio *bio_map_user_iov(struct request_queue *, | 331 | extern struct bio *bio_map_user_iov(struct request_queue *, |
331 | struct block_device *, | 332 | struct block_device *, |
332 | struct sg_iovec *, int, int, gfp_t); | 333 | struct sg_iovec *, int, int, gfp_t); |
@@ -337,9 +338,10 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int, | |||
337 | gfp_t, int); | 338 | gfp_t, int); |
338 | extern void bio_set_pages_dirty(struct bio *bio); | 339 | extern void bio_set_pages_dirty(struct bio *bio); |
339 | extern void bio_check_pages_dirty(struct bio *bio); | 340 | extern void bio_check_pages_dirty(struct bio *bio); |
340 | extern struct bio *bio_copy_user(struct request_queue *, unsigned long, | 341 | extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, |
341 | unsigned int, int, gfp_t); | 342 | unsigned long, unsigned int, int, gfp_t); |
342 | extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *, | 343 | extern struct bio *bio_copy_user_iov(struct request_queue *, |
344 | struct rq_map_data *, struct sg_iovec *, | ||
343 | int, int, gfp_t); | 345 | int, int, gfp_t); |
344 | extern int bio_uncopy_user(struct bio *); | 346 | extern int bio_uncopy_user(struct bio *); |
345 | void zero_fill_bio(struct bio *bio); | 347 | void zero_fill_bio(struct bio *bio); |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 00e388d0e221..358ac423ed2f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -642,6 +642,12 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio) | |||
642 | } | 642 | } |
643 | #endif /* CONFIG_MMU */ | 643 | #endif /* CONFIG_MMU */ |
644 | 644 | ||
645 | struct rq_map_data { | ||
646 | struct page **pages; | ||
647 | int page_order; | ||
648 | int nr_entries; | ||
649 | }; | ||
650 | |||
645 | struct req_iterator { | 651 | struct req_iterator { |
646 | int i; | 652 | int i; |
647 | struct bio *bio; | 653 | struct bio *bio; |
@@ -711,11 +717,13 @@ extern void __blk_run_queue(struct request_queue *); | |||
711 | extern void blk_run_queue(struct request_queue *); | 717 | extern void blk_run_queue(struct request_queue *); |
712 | extern void blk_start_queueing(struct request_queue *); | 718 | extern void blk_start_queueing(struct request_queue *); |
713 | extern int blk_rq_map_user(struct request_queue *, struct request *, | 719 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
714 | void __user *, unsigned long, gfp_t); | 720 | struct rq_map_data *, void __user *, unsigned long, |
721 | gfp_t); | ||
715 | extern int blk_rq_unmap_user(struct bio *); | 722 | extern int blk_rq_unmap_user(struct bio *); |
716 | extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); | 723 | extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); |
717 | extern int blk_rq_map_user_iov(struct request_queue *, struct request *, | 724 | extern int blk_rq_map_user_iov(struct request_queue *, struct request *, |
718 | struct sg_iovec *, int, unsigned int, gfp_t); | 725 | struct rq_map_data *, struct sg_iovec *, int, |
726 | unsigned int, gfp_t); | ||
719 | extern int blk_execute_rq(struct request_queue *, struct gendisk *, | 727 | extern int blk_execute_rq(struct request_queue *, struct gendisk *, |
720 | struct request *, int); | 728 | struct request *, int); |
721 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, | 729 | extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, |