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>
This commit is contained in:
@@ -606,13 +606,12 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns
|
||||
{
|
||||
struct request *rq = pc->rq;
|
||||
struct bio_vec *bvec;
|
||||
struct bio *bio;
|
||||
struct req_iterator iter;
|
||||
unsigned long flags;
|
||||
char *data;
|
||||
int count, i, done = 0;
|
||||
int count, done = 0;
|
||||
|
||||
rq_for_each_bio(bio, rq) {
|
||||
bio_for_each_segment(bvec, bio, i) {
|
||||
rq_for_each_segment(bvec, rq, iter) {
|
||||
if (!bcount)
|
||||
break;
|
||||
|
||||
@@ -625,7 +624,6 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns
|
||||
bcount -= count;
|
||||
pc->b_count += count;
|
||||
done += count;
|
||||
}
|
||||
}
|
||||
|
||||
idefloppy_do_end_request(drive, 1, done >> 9);
|
||||
@@ -639,14 +637,13 @@ static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, uns
|
||||
static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount)
|
||||
{
|
||||
struct request *rq = pc->rq;
|
||||
struct bio *bio;
|
||||
struct req_iterator iter;
|
||||
struct bio_vec *bvec;
|
||||
unsigned long flags;
|
||||
int count, i, done = 0;
|
||||
int count, done = 0;
|
||||
char *data;
|
||||
|
||||
rq_for_each_bio(bio, rq) {
|
||||
bio_for_each_segment(bvec, bio, i) {
|
||||
rq_for_each_segment(bvec, rq, iter) {
|
||||
if (!bcount)
|
||||
break;
|
||||
|
||||
@@ -659,7 +656,6 @@ static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, un
|
||||
bcount -= count;
|
||||
pc->b_count += count;
|
||||
done += count;
|
||||
}
|
||||
}
|
||||
|
||||
idefloppy_do_end_request(drive, 1, done >> 9);
|
||||
|
Reference in New Issue
Block a user