diff options
author | Sam Bradshaw <sbradshaw@micron.com> | 2013-05-15 10:09:05 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-05-15 10:09:05 +0200 |
commit | 093c959307f2f5af72b24fdc4af7d4d0263f6eea (patch) | |
tree | 1ec8fc2b23452790a9ee4bdf14dd442d2ca97fb7 /drivers/block/mtip32xx | |
parent | 974a51a245c2c8bece21cf2d3cbfc8261260f729 (diff) | |
download | op-kernel-dev-093c959307f2f5af72b24fdc4af7d4d0263f6eea.zip op-kernel-dev-093c959307f2f5af72b24fdc4af7d4d0263f6eea.tar.gz |
mtip32xx: Correctly handle bio->bi_idx != 0 conditions
Stacking drivers may append bvecs to existing bio's, resulting
in non-zero bi_idx conditions. This patch counts the loops of
bio_for_each_segment() rather than inheriting the bi_idx value
to pass as a segment count to the hardware submission routine.
Signed-off-by: Sam Bradshaw <sbradshaw@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/mtip32xx')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index e366c74..20dd52a 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -3864,7 +3864,7 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) struct driver_data *dd = queue->queuedata; struct scatterlist *sg; struct bio_vec *bvec; - int nents = 0; + int i, nents = 0; int tag = 0, unaligned = 0; if (unlikely(dd->dd_flag & MTIP_DDF_STOP_IO)) { @@ -3922,11 +3922,12 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) } /* Create the scatter list for this bio. */ - bio_for_each_segment(bvec, bio, nents) { + bio_for_each_segment(bvec, bio, i) { sg_set_page(&sg[nents], bvec->bv_page, bvec->bv_len, bvec->bv_offset); + nents++; } /* Issue the read/write. */ |