diff options
author | Kent Overstreet <koverstreet@google.com> | 2012-09-06 17:14:43 -0400 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-03-23 17:15:33 -0400 |
commit | 8be185f2c9d54d6bc0bac1445227b67cb14c0b13 (patch) | |
tree | dc8b688b417651484a391553c29deafb733ba92d /drivers/md/raid10.c | |
parent | 9e882242c6193ae6f416f2d8d8db0d9126bd996b (diff) |
raid10: Use bio_reset()
More prep work for immutable bio vecs, mainly getting rid of references
to bi_idx.
bio_reset was being open coded in a few places. The one in sync_request
was a bit nontrivial to convert, so could use some extra eyeballs.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>
Acked-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 434586d43115..e32e8b1042f8 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2077,13 +2077,10 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
2077 | * First we need to fixup bv_offset, bv_len and | 2077 | * First we need to fixup bv_offset, bv_len and |
2078 | * bi_vecs, as the read request might have corrupted these | 2078 | * bi_vecs, as the read request might have corrupted these |
2079 | */ | 2079 | */ |
2080 | bio_reset(tbio); | ||
2081 | |||
2080 | tbio->bi_vcnt = vcnt; | 2082 | tbio->bi_vcnt = vcnt; |
2081 | tbio->bi_size = r10_bio->sectors << 9; | 2083 | tbio->bi_size = r10_bio->sectors << 9; |
2082 | tbio->bi_idx = 0; | ||
2083 | tbio->bi_phys_segments = 0; | ||
2084 | tbio->bi_flags &= ~(BIO_POOL_MASK - 1); | ||
2085 | tbio->bi_flags |= 1 << BIO_UPTODATE; | ||
2086 | tbio->bi_next = NULL; | ||
2087 | tbio->bi_rw = WRITE; | 2084 | tbio->bi_rw = WRITE; |
2088 | tbio->bi_private = r10_bio; | 2085 | tbio->bi_private = r10_bio; |
2089 | tbio->bi_sector = r10_bio->devs[i].addr; | 2086 | tbio->bi_sector = r10_bio->devs[i].addr; |
@@ -3090,6 +3087,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3090 | } | 3087 | } |
3091 | } | 3088 | } |
3092 | bio = r10_bio->devs[0].bio; | 3089 | bio = r10_bio->devs[0].bio; |
3090 | bio_reset(bio); | ||
3093 | bio->bi_next = biolist; | 3091 | bio->bi_next = biolist; |
3094 | biolist = bio; | 3092 | biolist = bio; |
3095 | bio->bi_private = r10_bio; | 3093 | bio->bi_private = r10_bio; |
@@ -3114,6 +3112,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3114 | rdev = mirror->rdev; | 3112 | rdev = mirror->rdev; |
3115 | if (!test_bit(In_sync, &rdev->flags)) { | 3113 | if (!test_bit(In_sync, &rdev->flags)) { |
3116 | bio = r10_bio->devs[1].bio; | 3114 | bio = r10_bio->devs[1].bio; |
3115 | bio_reset(bio); | ||
3117 | bio->bi_next = biolist; | 3116 | bio->bi_next = biolist; |
3118 | biolist = bio; | 3117 | biolist = bio; |
3119 | bio->bi_private = r10_bio; | 3118 | bio->bi_private = r10_bio; |
@@ -3142,6 +3141,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3142 | if (rdev == NULL || bio == NULL || | 3141 | if (rdev == NULL || bio == NULL || |
3143 | test_bit(Faulty, &rdev->flags)) | 3142 | test_bit(Faulty, &rdev->flags)) |
3144 | break; | 3143 | break; |
3144 | bio_reset(bio); | ||
3145 | bio->bi_next = biolist; | 3145 | bio->bi_next = biolist; |
3146 | biolist = bio; | 3146 | biolist = bio; |
3147 | bio->bi_private = r10_bio; | 3147 | bio->bi_private = r10_bio; |
@@ -3240,7 +3240,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3240 | r10_bio->devs[i].repl_bio->bi_end_io = NULL; | 3240 | r10_bio->devs[i].repl_bio->bi_end_io = NULL; |
3241 | 3241 | ||
3242 | bio = r10_bio->devs[i].bio; | 3242 | bio = r10_bio->devs[i].bio; |
3243 | bio->bi_end_io = NULL; | 3243 | bio_reset(bio); |
3244 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | 3244 | clear_bit(BIO_UPTODATE, &bio->bi_flags); |
3245 | if (conf->mirrors[d].rdev == NULL || | 3245 | if (conf->mirrors[d].rdev == NULL || |
3246 | test_bit(Faulty, &conf->mirrors[d].rdev->flags)) | 3246 | test_bit(Faulty, &conf->mirrors[d].rdev->flags)) |
@@ -3277,6 +3277,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3277 | 3277 | ||
3278 | /* Need to set up for writing to the replacement */ | 3278 | /* Need to set up for writing to the replacement */ |
3279 | bio = r10_bio->devs[i].repl_bio; | 3279 | bio = r10_bio->devs[i].repl_bio; |
3280 | bio_reset(bio); | ||
3280 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | 3281 | clear_bit(BIO_UPTODATE, &bio->bi_flags); |
3281 | 3282 | ||
3282 | sector = r10_bio->devs[i].addr; | 3283 | sector = r10_bio->devs[i].addr; |
@@ -3310,17 +3311,6 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3310 | } | 3311 | } |
3311 | } | 3312 | } |
3312 | 3313 | ||
3313 | for (bio = biolist; bio ; bio=bio->bi_next) { | ||
3314 | |||
3315 | bio->bi_flags &= ~(BIO_POOL_MASK - 1); | ||
3316 | if (bio->bi_end_io) | ||
3317 | bio->bi_flags |= 1 << BIO_UPTODATE; | ||
3318 | bio->bi_vcnt = 0; | ||
3319 | bio->bi_idx = 0; | ||
3320 | bio->bi_phys_segments = 0; | ||
3321 | bio->bi_size = 0; | ||
3322 | } | ||
3323 | |||
3324 | nr_sectors = 0; | 3314 | nr_sectors = 0; |
3325 | if (sector_nr + max_sync < max_sector) | 3315 | if (sector_nr + max_sync < max_sector) |
3326 | max_sector = sector_nr + max_sync; | 3316 | max_sector = sector_nr + max_sync; |
@@ -4390,17 +4380,14 @@ read_more: | |||
4390 | } | 4380 | } |
4391 | if (!rdev2 || test_bit(Faulty, &rdev2->flags)) | 4381 | if (!rdev2 || test_bit(Faulty, &rdev2->flags)) |
4392 | continue; | 4382 | continue; |
4383 | |||
4384 | bio_reset(b); | ||
4393 | b->bi_bdev = rdev2->bdev; | 4385 | b->bi_bdev = rdev2->bdev; |
4394 | b->bi_sector = r10_bio->devs[s/2].addr + rdev2->new_data_offset; | 4386 | b->bi_sector = r10_bio->devs[s/2].addr + rdev2->new_data_offset; |
4395 | b->bi_private = r10_bio; | 4387 | b->bi_private = r10_bio; |
4396 | b->bi_end_io = end_reshape_write; | 4388 | b->bi_end_io = end_reshape_write; |
4397 | b->bi_rw = WRITE; | 4389 | b->bi_rw = WRITE; |
4398 | b->bi_flags &= ~(BIO_POOL_MASK - 1); | ||
4399 | b->bi_flags |= 1 << BIO_UPTODATE; | ||
4400 | b->bi_next = blist; | 4390 | b->bi_next = blist; |
4401 | b->bi_vcnt = 0; | ||
4402 | b->bi_idx = 0; | ||
4403 | b->bi_size = 0; | ||
4404 | blist = b; | 4391 | blist = b; |
4405 | } | 4392 | } |
4406 | 4393 | ||