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