aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-09-14 07:06:53 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 05:05:08 -0400
commit761a15e7ac0be7df0c86a55f38a84c080fa179ae (patch)
tree9baea030284d65bdbe82be3d580e9b6f7f9b86b2
parentbb879463b5346302a3891ebb7406247c53cebac1 (diff)
pktcdvd: don't rely on bio_init() preserving bio->bi_io_vec
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/pktcdvd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 540bf3676985..ba2f550963bc 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1133,16 +1133,20 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt)
1133 * Schedule reads for missing parts of the packet. 1133 * Schedule reads for missing parts of the packet.
1134 */ 1134 */
1135 for (f = 0; f < pkt->frames; f++) { 1135 for (f = 0; f < pkt->frames; f++) {
1136 struct bio_vec *vec;
1137
1136 int p, offset; 1138 int p, offset;
1137 if (written[f]) 1139 if (written[f])
1138 continue; 1140 continue;
1139 bio = pkt->r_bios[f]; 1141 bio = pkt->r_bios[f];
1142 vec = bio->bi_io_vec;
1140 bio_init(bio); 1143 bio_init(bio);
1141 bio->bi_max_vecs = 1; 1144 bio->bi_max_vecs = 1;
1142 bio->bi_sector = pkt->sector + f * (CD_FRAMESIZE >> 9); 1145 bio->bi_sector = pkt->sector + f * (CD_FRAMESIZE >> 9);
1143 bio->bi_bdev = pd->bdev; 1146 bio->bi_bdev = pd->bdev;
1144 bio->bi_end_io = pkt_end_io_read; 1147 bio->bi_end_io = pkt_end_io_read;
1145 bio->bi_private = pkt; 1148 bio->bi_private = pkt;
1149 bio->bi_io_vec = vec;
1146 1150
1147 p = (f * CD_FRAMESIZE) / PAGE_SIZE; 1151 p = (f * CD_FRAMESIZE) / PAGE_SIZE;
1148 offset = (f * CD_FRAMESIZE) % PAGE_SIZE; 1152 offset = (f * CD_FRAMESIZE) % PAGE_SIZE;
@@ -1439,6 +1443,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
1439 pkt->w_bio->bi_bdev = pd->bdev; 1443 pkt->w_bio->bi_bdev = pd->bdev;
1440 pkt->w_bio->bi_end_io = pkt_end_io_packet_write; 1444 pkt->w_bio->bi_end_io = pkt_end_io_packet_write;
1441 pkt->w_bio->bi_private = pkt; 1445 pkt->w_bio->bi_private = pkt;
1446 pkt->w_bio->bi_io_vec = bvec;
1442 for (f = 0; f < pkt->frames; f++) 1447 for (f = 0; f < pkt->frames; f++)
1443 if (!bio_add_page(pkt->w_bio, bvec[f].bv_page, CD_FRAMESIZE, bvec[f].bv_offset)) 1448 if (!bio_add_page(pkt->w_bio, bvec[f].bv_page, CD_FRAMESIZE, bvec[f].bv_offset))
1444 BUG(); 1449 BUG();