aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5044babfcda0..702812824195 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5517,7 +5517,6 @@ static int raid5_start_reshape(mddev_t *mddev)
5517 raid5_conf_t *conf = mddev->private; 5517 raid5_conf_t *conf = mddev->private;
5518 mdk_rdev_t *rdev; 5518 mdk_rdev_t *rdev;
5519 int spares = 0; 5519 int spares = 0;
5520 int added_devices = 0;
5521 unsigned long flags; 5520 unsigned long flags;
5522 5521
5523 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) 5522 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
@@ -5527,8 +5526,8 @@ static int raid5_start_reshape(mddev_t *mddev)
5527 return -ENOSPC; 5526 return -ENOSPC;
5528 5527
5529 list_for_each_entry(rdev, &mddev->disks, same_set) 5528 list_for_each_entry(rdev, &mddev->disks, same_set)
5530 if ((rdev->raid_disk < 0 || rdev->raid_disk >= conf->raid_disks) 5529 if (!test_bit(In_sync, &rdev->flags)
5531 && !test_bit(Faulty, &rdev->flags)) 5530 && !test_bit(Faulty, &rdev->flags))
5532 spares++; 5531 spares++;
5533 5532
5534 if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded) 5533 if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded)
@@ -5571,34 +5570,35 @@ static int raid5_start_reshape(mddev_t *mddev)
5571 * to correctly record the "partially reconstructed" state of 5570 * to correctly record the "partially reconstructed" state of
5572 * such devices during the reshape and confusion could result. 5571 * such devices during the reshape and confusion could result.
5573 */ 5572 */
5574 if (mddev->delta_disks >= 0) 5573 if (mddev->delta_disks >= 0) {
5575 list_for_each_entry(rdev, &mddev->disks, same_set) 5574 int added_devices = 0;
5576 if (rdev->raid_disk < 0 && 5575 list_for_each_entry(rdev, &mddev->disks, same_set)
5577 !test_bit(Faulty, &rdev->flags)) { 5576 if (rdev->raid_disk < 0 &&
5578 if (raid5_add_disk(mddev, rdev) == 0) { 5577 !test_bit(Faulty, &rdev->flags)) {
5579 char nm[20]; 5578 if (raid5_add_disk(mddev, rdev) == 0) {
5580 if (rdev->raid_disk >= conf->previous_raid_disks) { 5579 char nm[20];
5581 set_bit(In_sync, &rdev->flags); 5580 if (rdev->raid_disk
5582 added_devices++; 5581 >= conf->previous_raid_disks) {
5583 } else 5582 set_bit(In_sync, &rdev->flags);
5584 rdev->recovery_offset = 0; 5583 added_devices++;
5585 sprintf(nm, "rd%d", rdev->raid_disk); 5584 } else
5586 if (sysfs_create_link(&mddev->kobj, 5585 rdev->recovery_offset = 0;
5587 &rdev->kobj, nm)) 5586 sprintf(nm, "rd%d", rdev->raid_disk);
5588 /* Failure here is OK */; 5587 if (sysfs_create_link(&mddev->kobj,
5589 } else 5588 &rdev->kobj, nm))
5590 break; 5589 /* Failure here is OK */;
5591 } else if (rdev->raid_disk >= conf->previous_raid_disks 5590 }
5592 && !test_bit(Faulty, &rdev->flags)) { 5591 } else if (rdev->raid_disk >= conf->previous_raid_disks
5593 /* This is a spare that was manually added */ 5592 && !test_bit(Faulty, &rdev->flags)) {
5594 set_bit(In_sync, &rdev->flags); 5593 /* This is a spare that was manually added */
5595 added_devices++; 5594 set_bit(In_sync, &rdev->flags);
5596 } 5595 added_devices++;
5596 }
5597 5597
5598 /* When a reshape changes the number of devices, ->degraded 5598 /* When a reshape changes the number of devices,
5599 * is measured against the larger of the pre and post number of 5599 * ->degraded is measured against the larger of the
5600 * devices.*/ 5600 * pre and post number of devices.
5601 if (mddev->delta_disks > 0) { 5601 */
5602 spin_lock_irqsave(&conf->device_lock, flags); 5602 spin_lock_irqsave(&conf->device_lock, flags);
5603 mddev->degraded += (conf->raid_disks - conf->previous_raid_disks) 5603 mddev->degraded += (conf->raid_disks - conf->previous_raid_disks)
5604 - added_devices; 5604 - added_devices;