summaryrefslogtreecommitdiffstats
path: root/drivers/block/lguest_blk.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-09-25 12:35:59 +0200
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 09:25:56 +0200
commit5705f7021748a69d84d6567e68e8851dab551464 (patch)
tree5a6dbc8fc6055c0334f4a97540e36a7844b9c482 /drivers/block/lguest_blk.c
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 'drivers/block/lguest_blk.c')
-rw-r--r--drivers/block/lguest_blk.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/block/lguest_blk.c b/drivers/block/lguest_blk.c
index 160cf14431a..1e838ae60a6 100644
--- a/drivers/block/lguest_blk.c
+++ b/drivers/block/lguest_blk.c
@@ -142,12 +142,11 @@ static irqreturn_t lgb_irq(int irq, void *_bd)
* return the total length. */
static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
{
- unsigned int i = 0, idx, len = 0;
- struct bio *bio;
+ unsigned int i = 0, len = 0;
+ struct req_iterator iter;
+ struct bio_vec *bvec;
- rq_for_each_bio(bio, req) {
- struct bio_vec *bvec;
- bio_for_each_segment(bvec, bio, idx) {
+ rq_for_each_segment(bvec, req, iter) {
/* We told the block layer not to give us too many. */
BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
/* If we had a zero-length segment, it would look like
@@ -160,7 +159,6 @@ static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
dma->len[i] = bvec->bv_len;
len += bvec->bv_len;
i++;
- }
}
/* If the array isn't full, we mark the end with a 0 length */
if (i < LGUEST_MAX_DMA_SECTIONS)