aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-09-25 06:35:59 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 03:25:56 -0400
commit5705f7021748a69d84d6567e68e8851dab551464 (patch)
tree5a6dbc8fc6055c0334f4a97540e36a7844b9c482 /include
parent9dfa52831e96194b8649613e3131baa2c109f7dc (diff)
Introduce rq_for_each_segment replacing rq_for_each_bio
Every usage of rq_for_each_bio wraps a usage of bio_for_each_segment, so these can be combined into rq_for_each_segment. We define "struct req_iterator" to hold the 'bio' and 'index' that are needed for the double iteration. Signed-off-by: Neil Brown <neilb@suse.de> Various compile fixes by me... Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b126c6f68e27..a4b13b8a9d09 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -637,10 +637,23 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
637} 637}
638#endif /* CONFIG_MMU */ 638#endif /* CONFIG_MMU */
639 639
640#define rq_for_each_bio(_bio, rq) \ 640struct req_iterator {
641 int i;
642 struct bio *bio;
643};
644
645/* This should not be used directly - use rq_for_each_segment */
646#define __rq_for_each_bio(_bio, rq) \
641 if ((rq->bio)) \ 647 if ((rq->bio)) \
642 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) 648 for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
643 649
650#define rq_for_each_segment(bvl, _rq, _iter) \
651 __rq_for_each_bio(_iter.bio, _rq) \
652 bio_for_each_segment(bvl, _iter.bio, _iter.i)
653
654#define rq_iter_last(rq, _iter) \
655 (_iter.bio->bi_next == NULL && _iter.i == _iter.bio->bi_vcnt-1)
656
644extern int blk_register_queue(struct gendisk *disk); 657extern int blk_register_queue(struct gendisk *disk);
645extern void blk_unregister_queue(struct gendisk *disk); 658extern void blk_unregister_queue(struct gendisk *disk);
646extern void register_disk(struct gendisk *dev); 659extern void register_disk(struct gendisk *dev);