diff options
author | NeilBrown <neilb@suse.com> | 2015-08-13 22:07:57 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.com> | 2015-08-31 13:43:50 -0400 |
commit | 34a6f80e1639b124f24b5fadc1d45d69417cbace (patch) | |
tree | 4b14f687efb09d998312f9ff3805df1ba477e49b | |
parent | 95af587e95aacb9cfda4a9641069a5244a540dc8 (diff) |
md/raid5: use bio_list for the list of bios to return.
This will make it easier to splice two lists together which will
be needed in future patch.
Signed-off-by: NeilBrown <neilb@suse.com>
-rw-r--r-- | drivers/md/raid5.c | 41 | ||||
-rw-r--r-- | drivers/md/raid5.h | 2 |
2 files changed, 16 insertions, 27 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7b0c706f33e7..214dcca0d7f8 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -223,18 +223,14 @@ static int raid6_idx_to_slot(int idx, struct stripe_head *sh, | |||
223 | return slot; | 223 | return slot; |
224 | } | 224 | } |
225 | 225 | ||
226 | static void return_io(struct bio *return_bi) | 226 | static void return_io(struct bio_list *return_bi) |
227 | { | 227 | { |
228 | struct bio *bi = return_bi; | 228 | struct bio *bi; |
229 | while (bi) { | 229 | while ((bi = bio_list_pop(return_bi)) != NULL) { |
230 | |||
231 | return_bi = bi->bi_next; | ||
232 | bi->bi_next = NULL; | ||
233 | bi->bi_iter.bi_size = 0; | 230 | bi->bi_iter.bi_size = 0; |
234 | trace_block_bio_complete(bdev_get_queue(bi->bi_bdev), | 231 | trace_block_bio_complete(bdev_get_queue(bi->bi_bdev), |
235 | bi, 0); | 232 | bi, 0); |
236 | bio_endio(bi, 0); | 233 | bio_endio(bi, 0); |
237 | bi = return_bi; | ||
238 | } | 234 | } |
239 | } | 235 | } |
240 | 236 | ||
@@ -1177,7 +1173,7 @@ async_copy_data(int frombio, struct bio *bio, struct page **page, | |||
1177 | static void ops_complete_biofill(void *stripe_head_ref) | 1173 | static void ops_complete_biofill(void *stripe_head_ref) |
1178 | { | 1174 | { |
1179 | struct stripe_head *sh = stripe_head_ref; | 1175 | struct stripe_head *sh = stripe_head_ref; |
1180 | struct bio *return_bi = NULL; | 1176 | struct bio_list return_bi = BIO_EMPTY_LIST; |
1181 | int i; | 1177 | int i; |
1182 | 1178 | ||
1183 | pr_debug("%s: stripe %llu\n", __func__, | 1179 | pr_debug("%s: stripe %llu\n", __func__, |
@@ -1201,17 +1197,15 @@ static void ops_complete_biofill(void *stripe_head_ref) | |||
1201 | while (rbi && rbi->bi_iter.bi_sector < | 1197 | while (rbi && rbi->bi_iter.bi_sector < |
1202 | dev->sector + STRIPE_SECTORS) { | 1198 | dev->sector + STRIPE_SECTORS) { |
1203 | rbi2 = r5_next_bio(rbi, dev->sector); | 1199 | rbi2 = r5_next_bio(rbi, dev->sector); |
1204 | if (!raid5_dec_bi_active_stripes(rbi)) { | 1200 | if (!raid5_dec_bi_active_stripes(rbi)) |
1205 | rbi->bi_next = return_bi; | 1201 | bio_list_add(&return_bi, rbi); |
1206 | return_bi = rbi; | ||
1207 | } | ||
1208 | rbi = rbi2; | 1202 | rbi = rbi2; |
1209 | } | 1203 | } |
1210 | } | 1204 | } |
1211 | } | 1205 | } |
1212 | clear_bit(STRIPE_BIOFILL_RUN, &sh->state); | 1206 | clear_bit(STRIPE_BIOFILL_RUN, &sh->state); |
1213 | 1207 | ||
1214 | return_io(return_bi); | 1208 | return_io(&return_bi); |
1215 | 1209 | ||
1216 | set_bit(STRIPE_HANDLE, &sh->state); | 1210 | set_bit(STRIPE_HANDLE, &sh->state); |
1217 | release_stripe(sh); | 1211 | release_stripe(sh); |
@@ -3071,7 +3065,7 @@ static void stripe_set_idx(sector_t stripe, struct r5conf *conf, int previous, | |||
3071 | static void | 3065 | static void |
3072 | handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, | 3066 | handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, |
3073 | struct stripe_head_state *s, int disks, | 3067 | struct stripe_head_state *s, int disks, |
3074 | struct bio **return_bi) | 3068 | struct bio_list *return_bi) |
3075 | { | 3069 | { |
3076 | int i; | 3070 | int i; |
3077 | BUG_ON(sh->batch_head); | 3071 | BUG_ON(sh->batch_head); |
@@ -3115,8 +3109,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, | |||
3115 | clear_bit(BIO_UPTODATE, &bi->bi_flags); | 3109 | clear_bit(BIO_UPTODATE, &bi->bi_flags); |
3116 | if (!raid5_dec_bi_active_stripes(bi)) { | 3110 | if (!raid5_dec_bi_active_stripes(bi)) { |
3117 | md_write_end(conf->mddev); | 3111 | md_write_end(conf->mddev); |
3118 | bi->bi_next = *return_bi; | 3112 | bio_list_add(return_bi, bi); |
3119 | *return_bi = bi; | ||
3120 | } | 3113 | } |
3121 | bi = nextbi; | 3114 | bi = nextbi; |
3122 | } | 3115 | } |
@@ -3139,8 +3132,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, | |||
3139 | clear_bit(BIO_UPTODATE, &bi->bi_flags); | 3132 | clear_bit(BIO_UPTODATE, &bi->bi_flags); |
3140 | if (!raid5_dec_bi_active_stripes(bi)) { | 3133 | if (!raid5_dec_bi_active_stripes(bi)) { |
3141 | md_write_end(conf->mddev); | 3134 | md_write_end(conf->mddev); |
3142 | bi->bi_next = *return_bi; | 3135 | bio_list_add(return_bi, bi); |
3143 | *return_bi = bi; | ||
3144 | } | 3136 | } |
3145 | bi = bi2; | 3137 | bi = bi2; |
3146 | } | 3138 | } |
@@ -3162,10 +3154,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh, | |||
3162 | struct bio *nextbi = | 3154 | struct bio *nextbi = |
3163 | r5_next_bio(bi, sh->dev[i].sector); | 3155 | r5_next_bio(bi, sh->dev[i].sector); |
3164 | clear_bit(BIO_UPTODATE, &bi->bi_flags); | 3156 | clear_bit(BIO_UPTODATE, &bi->bi_flags); |
3165 | if (!raid5_dec_bi_active_stripes(bi)) { | 3157 | if (!raid5_dec_bi_active_stripes(bi)) |
3166 | bi->bi_next = *return_bi; | 3158 | bio_list_add(return_bi, bi); |
3167 | *return_bi = bi; | ||
3168 | } | ||
3169 | bi = nextbi; | 3159 | bi = nextbi; |
3170 | } | 3160 | } |
3171 | } | 3161 | } |
@@ -3444,7 +3434,7 @@ static void break_stripe_batch_list(struct stripe_head *head_sh, | |||
3444 | * never LOCKED, so we don't need to test 'failed' directly. | 3434 | * never LOCKED, so we don't need to test 'failed' directly. |
3445 | */ | 3435 | */ |
3446 | static void handle_stripe_clean_event(struct r5conf *conf, | 3436 | static void handle_stripe_clean_event(struct r5conf *conf, |
3447 | struct stripe_head *sh, int disks, struct bio **return_bi) | 3437 | struct stripe_head *sh, int disks, struct bio_list *return_bi) |
3448 | { | 3438 | { |
3449 | int i; | 3439 | int i; |
3450 | struct r5dev *dev; | 3440 | struct r5dev *dev; |
@@ -3478,8 +3468,7 @@ returnbi: | |||
3478 | wbi2 = r5_next_bio(wbi, dev->sector); | 3468 | wbi2 = r5_next_bio(wbi, dev->sector); |
3479 | if (!raid5_dec_bi_active_stripes(wbi)) { | 3469 | if (!raid5_dec_bi_active_stripes(wbi)) { |
3480 | md_write_end(conf->mddev); | 3470 | md_write_end(conf->mddev); |
3481 | wbi->bi_next = *return_bi; | 3471 | bio_list_add(return_bi, wbi); |
3482 | *return_bi = wbi; | ||
3483 | } | 3472 | } |
3484 | wbi = wbi2; | 3473 | wbi = wbi2; |
3485 | } | 3474 | } |
@@ -4612,7 +4601,7 @@ finish: | |||
4612 | md_wakeup_thread(conf->mddev->thread); | 4601 | md_wakeup_thread(conf->mddev->thread); |
4613 | } | 4602 | } |
4614 | 4603 | ||
4615 | return_io(s.return_bi); | 4604 | return_io(&s.return_bi); |
4616 | 4605 | ||
4617 | clear_bit_unlock(STRIPE_ACTIVE, &sh->state); | 4606 | clear_bit_unlock(STRIPE_ACTIVE, &sh->state); |
4618 | } | 4607 | } |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index d05144278690..1de82a6e4c23 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -265,7 +265,7 @@ struct stripe_head_state { | |||
265 | int dec_preread_active; | 265 | int dec_preread_active; |
266 | unsigned long ops_request; | 266 | unsigned long ops_request; |
267 | 267 | ||
268 | struct bio *return_bi; | 268 | struct bio_list return_bi; |
269 | struct md_rdev *blocked_rdev; | 269 | struct md_rdev *blocked_rdev; |
270 | int handle_bad_blocks; | 270 | int handle_bad_blocks; |
271 | }; | 271 | }; |