aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/raid5.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index fb11c13eb69c..bb4b12e370df 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3637,10 +3637,9 @@ static int make_request(struct request_queue *q, struct bio * bi)
3637 3637
3638 retry: 3638 retry:
3639 previous = 0; 3639 previous = 0;
3640 disks = conf->raid_disks;
3640 prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE); 3641 prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE);
3641 if (likely(conf->reshape_progress == MaxSector)) 3642 if (unlikely(conf->reshape_progress != MaxSector)) {
3642 disks = conf->raid_disks;
3643 else {
3644 /* spinlock is needed as reshape_progress may be 3643 /* spinlock is needed as reshape_progress may be
3645 * 64bit on a 32bit platform, and so it might be 3644 * 64bit on a 32bit platform, and so it might be
3646 * possible to see a half-updated value 3645 * possible to see a half-updated value
@@ -3650,7 +3649,6 @@ static int make_request(struct request_queue *q, struct bio * bi)
3650 * to check again. 3649 * to check again.
3651 */ 3650 */
3652 spin_lock_irq(&conf->device_lock); 3651 spin_lock_irq(&conf->device_lock);
3653 disks = conf->raid_disks;
3654 if (mddev->delta_disks < 0 3652 if (mddev->delta_disks < 0
3655 ? logical_sector < conf->reshape_progress 3653 ? logical_sector < conf->reshape_progress
3656 : logical_sector >= conf->reshape_progress) { 3654 : logical_sector >= conf->reshape_progress) {
@@ -3679,7 +3677,7 @@ static int make_request(struct request_queue *q, struct bio * bi)
3679 sh = get_active_stripe(conf, new_sector, previous, 3677 sh = get_active_stripe(conf, new_sector, previous,
3680 (bi->bi_rw&RWA_MASK)); 3678 (bi->bi_rw&RWA_MASK));
3681 if (sh) { 3679 if (sh) {
3682 if (unlikely(conf->reshape_progress != MaxSector)) { 3680 if (unlikely(previous)) {
3683 /* expansion might have moved on while waiting for a 3681 /* expansion might have moved on while waiting for a
3684 * stripe, so we must do the range check again. 3682 * stripe, so we must do the range check again.
3685 * Expansion could still move past after this 3683 * Expansion could still move past after this
@@ -3690,10 +3688,9 @@ static int make_request(struct request_queue *q, struct bio * bi)
3690 */ 3688 */
3691 int must_retry = 0; 3689 int must_retry = 0;
3692 spin_lock_irq(&conf->device_lock); 3690 spin_lock_irq(&conf->device_lock);
3693 if ((mddev->delta_disks < 0 3691 if (mddev->delta_disks < 0
3694 ? logical_sector >= conf->reshape_progress 3692 ? logical_sector >= conf->reshape_progress
3695 : logical_sector < conf->reshape_progress) 3693 : logical_sector < conf->reshape_progress)
3696 && previous)
3697 /* mismatch, need to try again */ 3694 /* mismatch, need to try again */
3698 must_retry = 1; 3695 must_retry = 1;
3699 spin_unlock_irq(&conf->device_lock); 3696 spin_unlock_irq(&conf->device_lock);
@@ -4977,6 +4974,7 @@ static void end_reshape(raid5_conf_t *conf)
4977 conf->previous_raid_disks = conf->raid_disks; 4974 conf->previous_raid_disks = conf->raid_disks;
4978 conf->reshape_progress = MaxSector; 4975 conf->reshape_progress = MaxSector;
4979 spin_unlock_irq(&conf->device_lock); 4976 spin_unlock_irq(&conf->device_lock);
4977 wake_up(&conf->wait_for_overlap);
4980 4978
4981 /* read-ahead size must cover two whole stripes, which is 4979 /* read-ahead size must cover two whole stripes, which is
4982 * 2 * (datadisks) * chunksize where 'n' is the number of raid devices 4980 * 2 * (datadisks) * chunksize where 'n' is the number of raid devices