aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index fccc8343a250..641b211fe3fe 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1375,6 +1375,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1375 1375
1376 sb->raid_disks = cpu_to_le32(mddev->raid_disks); 1376 sb->raid_disks = cpu_to_le32(mddev->raid_disks);
1377 sb->size = cpu_to_le64(mddev->dev_sectors); 1377 sb->size = cpu_to_le64(mddev->dev_sectors);
1378 sb->chunksize = cpu_to_le32(mddev->chunk_size >> 9);
1379 sb->level = cpu_to_le32(mddev->level);
1380 sb->layout = cpu_to_le32(mddev->layout);
1378 1381
1379 if (mddev->bitmap && mddev->bitmap_file == NULL) { 1382 if (mddev->bitmap && mddev->bitmap_file == NULL) {
1380 sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset); 1383 sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset);
@@ -3303,7 +3306,9 @@ static ssize_t
3303action_show(mddev_t *mddev, char *page) 3306action_show(mddev_t *mddev, char *page)
3304{ 3307{
3305 char *type = "idle"; 3308 char *type = "idle";
3306 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || 3309 if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
3310 type = "frozen";
3311 else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
3307 (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) { 3312 (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) {
3308 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) 3313 if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
3309 type = "reshape"; 3314 type = "reshape";
@@ -3326,7 +3331,12 @@ action_store(mddev_t *mddev, const char *page, size_t len)
3326 if (!mddev->pers || !mddev->pers->sync_request) 3331 if (!mddev->pers || !mddev->pers->sync_request)
3327 return -EINVAL; 3332 return -EINVAL;
3328 3333
3329 if (cmd_match(page, "idle")) { 3334 if (cmd_match(page, "frozen"))
3335 set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
3336 else
3337 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
3338
3339 if (cmd_match(page, "idle") || cmd_match(page, "frozen")) {
3330 if (mddev->sync_thread) { 3340 if (mddev->sync_thread) {
3331 set_bit(MD_RECOVERY_INTR, &mddev->recovery); 3341 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
3332 md_unregister_thread(mddev->sync_thread); 3342 md_unregister_thread(mddev->sync_thread);
@@ -3680,7 +3690,7 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len)
3680 if (strict_blocks_to_sectors(buf, &sectors) < 0) 3690 if (strict_blocks_to_sectors(buf, &sectors) < 0)
3681 return -EINVAL; 3691 return -EINVAL;
3682 if (mddev->pers && mddev->pers->size(mddev, 0, 0) < sectors) 3692 if (mddev->pers && mddev->pers->size(mddev, 0, 0) < sectors)
3683 return -EINVAL; 3693 return -E2BIG;
3684 3694
3685 mddev->external_size = 1; 3695 mddev->external_size = 1;
3686 } 3696 }
@@ -5557,7 +5567,7 @@ static struct block_device_operations md_fops =
5557 .owner = THIS_MODULE, 5567 .owner = THIS_MODULE,
5558 .open = md_open, 5568 .open = md_open,
5559 .release = md_release, 5569 .release = md_release,
5560 .locked_ioctl = md_ioctl, 5570 .ioctl = md_ioctl,
5561 .getgeo = md_getgeo, 5571 .getgeo = md_getgeo,
5562 .media_changed = md_media_changed, 5572 .media_changed = md_media_changed,
5563 .revalidate_disk= md_revalidate, 5573 .revalidate_disk= md_revalidate,
@@ -6352,12 +6362,13 @@ void md_do_sync(mddev_t *mddev)
6352 6362
6353 skipped = 0; 6363 skipped = 0;
6354 6364
6355 if ((mddev->curr_resync > mddev->curr_resync_completed && 6365 if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
6356 (mddev->curr_resync - mddev->curr_resync_completed) 6366 ((mddev->curr_resync > mddev->curr_resync_completed &&
6357 > (max_sectors >> 4)) || 6367 (mddev->curr_resync - mddev->curr_resync_completed)
6358 (j - mddev->curr_resync_completed)*2 6368 > (max_sectors >> 4)) ||
6359 >= mddev->resync_max - mddev->curr_resync_completed 6369 (j - mddev->curr_resync_completed)*2
6360 ) { 6370 >= mddev->resync_max - mddev->curr_resync_completed
6371 )) {
6361 /* time to update curr_resync_completed */ 6372 /* time to update curr_resync_completed */
6362 blk_unplug(mddev->queue); 6373 blk_unplug(mddev->queue);
6363 wait_event(mddev->recovery_wait, 6374 wait_event(mddev->recovery_wait,