diff options
author | Ming Lei <tom.leiming@gmail.com> | 2017-03-16 12:12:22 -0400 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-03-24 13:41:36 -0400 |
commit | c85ba149de4bd14aa028ac824f9f12aeded28b86 (patch) | |
tree | 8ec935d6b5b242e9174f73249bca6f55f2b1b366 | |
parent | 3560741e316b3ea52cfb27901ae284921445180f (diff) |
md: raid1/raid10: don't handle failure of bio_add_page()
All bio_add_page() is for adding one page into resync bio,
which is big enough to hold RESYNC_PAGES pages, and
the current bio_add_page() doesn't check queue limit any more,
so it won't fail at all.
remove unused label (shaohua)
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r-- | drivers/md/raid1.c | 22 | ||||
-rw-r--r-- | drivers/md/raid10.c | 41 |
2 files changed, 16 insertions, 47 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 941f81063891..569f501fb710 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2894,28 +2894,18 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, | |||
2894 | bio = r1_bio->bios[i]; | 2894 | bio = r1_bio->bios[i]; |
2895 | if (bio->bi_end_io) { | 2895 | if (bio->bi_end_io) { |
2896 | page = bio->bi_io_vec[bio->bi_vcnt].bv_page; | 2896 | page = bio->bi_io_vec[bio->bi_vcnt].bv_page; |
2897 | if (bio_add_page(bio, page, len, 0) == 0) { | 2897 | |
2898 | /* stop here */ | 2898 | /* |
2899 | bio->bi_io_vec[bio->bi_vcnt].bv_page = page; | 2899 | * won't fail because the vec table is big |
2900 | while (i > 0) { | 2900 | * enough to hold all these pages |
2901 | i--; | 2901 | */ |
2902 | bio = r1_bio->bios[i]; | 2902 | bio_add_page(bio, page, len, 0); |
2903 | if (bio->bi_end_io==NULL) | ||
2904 | continue; | ||
2905 | /* remove last page from this bio */ | ||
2906 | bio->bi_vcnt--; | ||
2907 | bio->bi_iter.bi_size -= len; | ||
2908 | bio_clear_flag(bio, BIO_SEG_VALID); | ||
2909 | } | ||
2910 | goto bio_full; | ||
2911 | } | ||
2912 | } | 2903 | } |
2913 | } | 2904 | } |
2914 | nr_sectors += len>>9; | 2905 | nr_sectors += len>>9; |
2915 | sector_nr += len>>9; | 2906 | sector_nr += len>>9; |
2916 | sync_blocks -= (len>>9); | 2907 | sync_blocks -= (len>>9); |
2917 | } while (r1_bio->bios[disk]->bi_vcnt < RESYNC_PAGES); | 2908 | } while (r1_bio->bios[disk]->bi_vcnt < RESYNC_PAGES); |
2918 | bio_full: | ||
2919 | r1_bio->sectors = nr_sectors; | 2909 | r1_bio->sectors = nr_sectors; |
2920 | 2910 | ||
2921 | if (mddev_is_clustered(mddev) && | 2911 | if (mddev_is_clustered(mddev) && |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 28c62e0c42aa..6c9783ba85db 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -3413,27 +3413,16 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3413 | if (len == 0) | 3413 | if (len == 0) |
3414 | break; | 3414 | break; |
3415 | for (bio= biolist ; bio ; bio=bio->bi_next) { | 3415 | for (bio= biolist ; bio ; bio=bio->bi_next) { |
3416 | struct bio *bio2; | ||
3417 | page = bio->bi_io_vec[bio->bi_vcnt].bv_page; | 3416 | page = bio->bi_io_vec[bio->bi_vcnt].bv_page; |
3418 | if (bio_add_page(bio, page, len, 0)) | 3417 | /* |
3419 | continue; | 3418 | * won't fail because the vec table is big enough |
3420 | 3419 | * to hold all these pages | |
3421 | /* stop here */ | 3420 | */ |
3422 | bio->bi_io_vec[bio->bi_vcnt].bv_page = page; | 3421 | bio_add_page(bio, page, len, 0); |
3423 | for (bio2 = biolist; | ||
3424 | bio2 && bio2 != bio; | ||
3425 | bio2 = bio2->bi_next) { | ||
3426 | /* remove last page from this bio */ | ||
3427 | bio2->bi_vcnt--; | ||
3428 | bio2->bi_iter.bi_size -= len; | ||
3429 | bio_clear_flag(bio2, BIO_SEG_VALID); | ||
3430 | } | ||
3431 | goto bio_full; | ||
3432 | } | 3422 | } |
3433 | nr_sectors += len>>9; | 3423 | nr_sectors += len>>9; |
3434 | sector_nr += len>>9; | 3424 | sector_nr += len>>9; |
3435 | } while (biolist->bi_vcnt < RESYNC_PAGES); | 3425 | } while (biolist->bi_vcnt < RESYNC_PAGES); |
3436 | bio_full: | ||
3437 | r10_bio->sectors = nr_sectors; | 3426 | r10_bio->sectors = nr_sectors; |
3438 | 3427 | ||
3439 | while (biolist) { | 3428 | while (biolist) { |
@@ -4502,25 +4491,15 @@ read_more: | |||
4502 | if (len > PAGE_SIZE) | 4491 | if (len > PAGE_SIZE) |
4503 | len = PAGE_SIZE; | 4492 | len = PAGE_SIZE; |
4504 | for (bio = blist; bio ; bio = bio->bi_next) { | 4493 | for (bio = blist; bio ; bio = bio->bi_next) { |
4505 | struct bio *bio2; | 4494 | /* |
4506 | if (bio_add_page(bio, page, len, 0)) | 4495 | * won't fail because the vec table is big enough |
4507 | continue; | 4496 | * to hold all these pages |
4508 | 4497 | */ | |
4509 | /* Didn't fit, must stop */ | 4498 | bio_add_page(bio, page, len, 0); |
4510 | for (bio2 = blist; | ||
4511 | bio2 && bio2 != bio; | ||
4512 | bio2 = bio2->bi_next) { | ||
4513 | /* Remove last page from this bio */ | ||
4514 | bio2->bi_vcnt--; | ||
4515 | bio2->bi_iter.bi_size -= len; | ||
4516 | bio_clear_flag(bio2, BIO_SEG_VALID); | ||
4517 | } | ||
4518 | goto bio_full; | ||
4519 | } | 4499 | } |
4520 | sector_nr += len >> 9; | 4500 | sector_nr += len >> 9; |
4521 | nr_sectors += len >> 9; | 4501 | nr_sectors += len >> 9; |
4522 | } | 4502 | } |
4523 | bio_full: | ||
4524 | rcu_read_unlock(); | 4503 | rcu_read_unlock(); |
4525 | r10_bio->sectors = nr_sectors; | 4504 | r10_bio->sectors = nr_sectors; |
4526 | 4505 | ||