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_fba.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_fba.c')
-rw-r--r-- | drivers/s390/block/dasd_fba.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index da16ead8aff2..119b8d2d5f17 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -234,14 +234,13 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req) | |||
234 | struct LO_fba_data *LO_data; | 234 | struct LO_fba_data *LO_data; |
235 | struct dasd_ccw_req *cqr; | 235 | struct dasd_ccw_req *cqr; |
236 | struct ccw1 *ccw; | 236 | struct ccw1 *ccw; |
237 | struct bio *bio; | 237 | struct req_iterator iter; |
238 | struct bio_vec *bv; | 238 | struct bio_vec *bv; |
239 | char *dst; | 239 | char *dst; |
240 | int count, cidaw, cplength, datasize; | 240 | int count, cidaw, cplength, datasize; |
241 | sector_t recid, first_rec, last_rec; | 241 | sector_t recid, first_rec, last_rec; |
242 | unsigned int blksize, off; | 242 | unsigned int blksize, off; |
243 | unsigned char cmd; | 243 | unsigned char cmd; |
244 | int i; | ||
245 | 244 | ||
246 | private = (struct dasd_fba_private *) device->private; | 245 | private = (struct dasd_fba_private *) device->private; |
247 | if (rq_data_dir(req) == READ) { | 246 | if (rq_data_dir(req) == READ) { |
@@ -257,8 +256,7 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req) | |||
257 | /* Check struct bio and count the number of blocks for the request. */ | 256 | /* Check struct bio and count the number of blocks for the request. */ |
258 | count = 0; | 257 | count = 0; |
259 | cidaw = 0; | 258 | cidaw = 0; |
260 | rq_for_each_bio(bio, req) { | 259 | rq_for_each_segment(bv, req, iter) { |
261 | bio_for_each_segment(bv, bio, i) { | ||
262 | if (bv->bv_len & (blksize - 1)) | 260 | if (bv->bv_len & (blksize - 1)) |
263 | /* Fba can only do full blocks. */ | 261 | /* Fba can only do full blocks. */ |
264 | return ERR_PTR(-EINVAL); | 262 | return ERR_PTR(-EINVAL); |
@@ -268,7 +266,6 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req) | |||
268 | bv->bv_len)) | 266 | bv->bv_len)) |
269 | cidaw += bv->bv_len / blksize; | 267 | cidaw += bv->bv_len / blksize; |
270 | #endif | 268 | #endif |
271 | } | ||
272 | } | 269 | } |
273 | /* Paranoia. */ | 270 | /* Paranoia. */ |
274 | if (count != last_rec - first_rec + 1) | 271 | if (count != last_rec - first_rec + 1) |
@@ -304,7 +301,7 @@ dasd_fba_build_cp(struct dasd_device * device, struct request *req) | |||
304 | locate_record(ccw++, LO_data++, rq_data_dir(req), 0, count); | 301 | locate_record(ccw++, LO_data++, rq_data_dir(req), 0, count); |
305 | } | 302 | } |
306 | recid = first_rec; | 303 | recid = first_rec; |
307 | rq_for_each_bio(bio, req) bio_for_each_segment(bv, bio, i) { | 304 | rq_for_each_segment(bv, req, iter) { |
308 | dst = page_address(bv->bv_page) + bv->bv_offset; | 305 | dst = page_address(bv->bv_page) + bv->bv_offset; |
309 | if (dasd_page_cache) { | 306 | if (dasd_page_cache) { |
310 | char *copy = kmem_cache_alloc(dasd_page_cache, | 307 | char *copy = kmem_cache_alloc(dasd_page_cache, |
@@ -359,11 +356,11 @@ dasd_fba_free_cp(struct dasd_ccw_req *cqr, struct request *req) | |||
359 | { | 356 | { |
360 | struct dasd_fba_private *private; | 357 | struct dasd_fba_private *private; |
361 | struct ccw1 *ccw; | 358 | struct ccw1 *ccw; |
362 | struct bio *bio; | 359 | struct req_iterator iter; |
363 | struct bio_vec *bv; | 360 | struct bio_vec *bv; |
364 | char *dst, *cda; | 361 | char *dst, *cda; |
365 | unsigned int blksize, off; | 362 | unsigned int blksize, off; |
366 | int i, status; | 363 | int status; |
367 | 364 | ||
368 | if (!dasd_page_cache) | 365 | if (!dasd_page_cache) |
369 | goto out; | 366 | goto out; |
@@ -374,7 +371,7 @@ dasd_fba_free_cp(struct dasd_ccw_req *cqr, struct request *req) | |||
374 | ccw++; | 371 | ccw++; |
375 | if (private->rdc_data.mode.bits.data_chain != 0) | 372 | if (private->rdc_data.mode.bits.data_chain != 0) |
376 | ccw++; | 373 | ccw++; |
377 | rq_for_each_bio(bio, req) bio_for_each_segment(bv, bio, i) { | 374 | rq_for_each_segment(bv, req, iter) { |
378 | dst = page_address(bv->bv_page) + bv->bv_offset; | 375 | dst = page_address(bv->bv_page) + bv->bv_offset; |
379 | for (off = 0; off < bv->bv_len; off += blksize) { | 376 | for (off = 0; off < bv->bv_len; off += blksize) { |
380 | /* Skip locate record. */ | 377 | /* Skip locate record. */ |