diff options
Diffstat (limited to 'drivers/block/lguest_blk.c')
-rw-r--r-- | drivers/block/lguest_blk.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/block/lguest_blk.c b/drivers/block/lguest_blk.c index 160cf14431ac..1e838ae60a60 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) | |||
142 | * return the total length. */ | 142 | * return the total length. */ |
143 | static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma) | 143 | static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma) |
144 | { | 144 | { |
145 | unsigned int i = 0, idx, len = 0; | 145 | unsigned int i = 0, len = 0; |
146 | struct bio *bio; | 146 | struct req_iterator iter; |
147 | struct bio_vec *bvec; | ||
147 | 148 | ||
148 | rq_for_each_bio(bio, req) { | 149 | rq_for_each_segment(bvec, req, iter) { |
149 | struct bio_vec *bvec; | ||
150 | bio_for_each_segment(bvec, bio, idx) { | ||
151 | /* We told the block layer not to give us too many. */ | 150 | /* We told the block layer not to give us too many. */ |
152 | BUG_ON(i == LGUEST_MAX_DMA_SECTIONS); | 151 | BUG_ON(i == LGUEST_MAX_DMA_SECTIONS); |
153 | /* If we had a zero-length segment, it would look like | 152 | /* 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) | |||
160 | dma->len[i] = bvec->bv_len; | 159 | dma->len[i] = bvec->bv_len; |
161 | len += bvec->bv_len; | 160 | len += bvec->bv_len; |
162 | i++; | 161 | i++; |
163 | } | ||
164 | } | 162 | } |
165 | /* If the array isn't full, we mark the end with a 0 length */ | 163 | /* If the array isn't full, we mark the end with a 0 length */ |
166 | if (i < LGUEST_MAX_DMA_SECTIONS) | 164 | if (i < LGUEST_MAX_DMA_SECTIONS) |