diff options
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 4070eff6f0f8..cead918578a7 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -374,26 +374,26 @@ static int raid1_end_write_request(struct bio *bio, unsigned int bytes_done, int | |||
374 | * already. | 374 | * already. |
375 | */ | 375 | */ |
376 | if (atomic_dec_and_test(&r1_bio->remaining)) { | 376 | if (atomic_dec_and_test(&r1_bio->remaining)) { |
377 | if (test_bit(R1BIO_BarrierRetry, &r1_bio->state)) { | 377 | if (test_bit(R1BIO_BarrierRetry, &r1_bio->state)) |
378 | reschedule_retry(r1_bio); | 378 | reschedule_retry(r1_bio); |
379 | goto out; | 379 | else { |
380 | } | 380 | /* it really is the end of this request */ |
381 | /* it really is the end of this request */ | 381 | if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { |
382 | if (test_bit(R1BIO_BehindIO, &r1_bio->state)) { | 382 | /* free extra copy of the data pages */ |
383 | /* free extra copy of the data pages */ | 383 | int i = bio->bi_vcnt; |
384 | int i = bio->bi_vcnt; | 384 | while (i--) |
385 | while (i--) | 385 | safe_put_page(bio->bi_io_vec[i].bv_page); |
386 | safe_put_page(bio->bi_io_vec[i].bv_page); | 386 | } |
387 | /* clear the bitmap if all writes complete successfully */ | ||
388 | bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector, | ||
389 | r1_bio->sectors, | ||
390 | !test_bit(R1BIO_Degraded, &r1_bio->state), | ||
391 | behind); | ||
392 | md_write_end(r1_bio->mddev); | ||
393 | raid_end_bio_io(r1_bio); | ||
387 | } | 394 | } |
388 | /* clear the bitmap if all writes complete successfully */ | ||
389 | bitmap_endwrite(r1_bio->mddev->bitmap, r1_bio->sector, | ||
390 | r1_bio->sectors, | ||
391 | !test_bit(R1BIO_Degraded, &r1_bio->state), | ||
392 | behind); | ||
393 | md_write_end(r1_bio->mddev); | ||
394 | raid_end_bio_io(r1_bio); | ||
395 | } | 395 | } |
396 | out: | 396 | |
397 | if (to_put) | 397 | if (to_put) |
398 | bio_put(to_put); | 398 | bio_put(to_put); |
399 | 399 | ||
@@ -1625,6 +1625,12 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1625 | /* before building a request, check if we can skip these blocks.. | 1625 | /* before building a request, check if we can skip these blocks.. |
1626 | * This call the bitmap_start_sync doesn't actually record anything | 1626 | * This call the bitmap_start_sync doesn't actually record anything |
1627 | */ | 1627 | */ |
1628 | if (mddev->bitmap == NULL && | ||
1629 | mddev->recovery_cp == MaxSector && | ||
1630 | conf->fullsync == 0) { | ||
1631 | *skipped = 1; | ||
1632 | return max_sector - sector_nr; | ||
1633 | } | ||
1628 | if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) && | 1634 | if (!bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, 1) && |
1629 | !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { | 1635 | !conf->fullsync && !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { |
1630 | /* We can skip this block, and probably several more */ | 1636 | /* We can skip this block, and probably several more */ |
@@ -1888,7 +1894,8 @@ static int run(mddev_t *mddev) | |||
1888 | 1894 | ||
1889 | disk = conf->mirrors + i; | 1895 | disk = conf->mirrors + i; |
1890 | 1896 | ||
1891 | if (!disk->rdev) { | 1897 | if (!disk->rdev || |
1898 | !test_bit(In_sync, &disk->rdev->flags)) { | ||
1892 | disk->head_position = 0; | 1899 | disk->head_position = 0; |
1893 | mddev->degraded++; | 1900 | mddev->degraded++; |
1894 | } | 1901 | } |