diff options
author | NeilBrown <neilb@suse.de> | 2007-09-25 06:35:59 -0400 |
---|---|---|
committer | Jens Axboe <axboe@carl.home.kernel.dk> | 2007-10-10 03:25:56 -0400 |
commit | 5705f7021748a69d84d6567e68e8851dab551464 (patch) | |
tree | 5a6dbc8fc6055c0334f4a97540e36a7844b9c482 /drivers/s390/block/dasd_diag.c | |
parent | 9dfa52831e96194b8649613e3131baa2c109f7dc (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/s390/block/dasd_diag.c')
-rw-r--r-- | drivers/s390/block/dasd_diag.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index d32c60dbdd82..6bb9676f203e 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -472,14 +472,13 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req) | |||
472 | struct dasd_ccw_req *cqr; | 472 | struct dasd_ccw_req *cqr; |
473 | struct dasd_diag_req *dreq; | 473 | struct dasd_diag_req *dreq; |
474 | struct dasd_diag_bio *dbio; | 474 | struct dasd_diag_bio *dbio; |
475 | struct bio *bio; | 475 | struct req_iterator iter; |
476 | struct bio_vec *bv; | 476 | struct bio_vec *bv; |
477 | char *dst; | 477 | char *dst; |
478 | unsigned int count, datasize; | 478 | unsigned int count, datasize; |
479 | sector_t recid, first_rec, last_rec; | 479 | sector_t recid, first_rec, last_rec; |
480 | unsigned int blksize, off; | 480 | unsigned int blksize, off; |
481 | unsigned char rw_cmd; | 481 | unsigned char rw_cmd; |
482 | int i; | ||
483 | 482 | ||
484 | if (rq_data_dir(req) == READ) | 483 | if (rq_data_dir(req) == READ) |
485 | rw_cmd = MDSK_READ_REQ; | 484 | rw_cmd = MDSK_READ_REQ; |
@@ -493,13 +492,11 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req) | |||
493 | last_rec = (req->sector + req->nr_sectors - 1) >> device->s2b_shift; | 492 | last_rec = (req->sector + req->nr_sectors - 1) >> device->s2b_shift; |
494 | /* Check struct bio and count the number of blocks for the request. */ | 493 | /* Check struct bio and count the number of blocks for the request. */ |
495 | count = 0; | 494 | count = 0; |
496 | rq_for_each_bio(bio, req) { | 495 | rq_for_each_segment(bv, req, iter) { |
497 | bio_for_each_segment(bv, bio, i) { | ||
498 | if (bv->bv_len & (blksize - 1)) | 496 | if (bv->bv_len & (blksize - 1)) |
499 | /* Fba can only do full blocks. */ | 497 | /* Fba can only do full blocks. */ |
500 | return ERR_PTR(-EINVAL); | 498 | return ERR_PTR(-EINVAL); |
501 | count += bv->bv_len >> (device->s2b_shift + 9); | 499 | count += bv->bv_len >> (device->s2b_shift + 9); |
502 | } | ||
503 | } | 500 | } |
504 | /* Paranoia. */ | 501 | /* Paranoia. */ |
505 | if (count != last_rec - first_rec + 1) | 502 | if (count != last_rec - first_rec + 1) |
@@ -516,8 +513,7 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req) | |||
516 | dreq->block_count = count; | 513 | dreq->block_count = count; |
517 | dbio = dreq->bio; | 514 | dbio = dreq->bio; |
518 | recid = first_rec; | 515 | recid = first_rec; |
519 | rq_for_each_bio(bio, req) { | 516 | rq_for_each_segment(bv, req, iter) { |
520 | bio_for_each_segment(bv, bio, i) { | ||
521 | dst = page_address(bv->bv_page) + bv->bv_offset; | 517 | dst = page_address(bv->bv_page) + bv->bv_offset; |
522 | for (off = 0; off < bv->bv_len; off += blksize) { | 518 | for (off = 0; off < bv->bv_len; off += blksize) { |
523 | memset(dbio, 0, sizeof (struct dasd_diag_bio)); | 519 | memset(dbio, 0, sizeof (struct dasd_diag_bio)); |
@@ -528,7 +524,6 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req) | |||
528 | dst += blksize; | 524 | dst += blksize; |
529 | recid++; | 525 | recid++; |
530 | } | 526 | } |
531 | } | ||
532 | } | 527 | } |
533 | cqr->retries = DIAG_MAX_RETRIES; | 528 | cqr->retries = DIAG_MAX_RETRIES; |
534 | cqr->buildclk = get_clock(); | 529 | cqr->buildclk = get_clock(); |