Commit b0f9ec04 authored by NeilBrown's avatar NeilBrown

md/raid5: minor code cleanups in make_request.

... and to be certain the that make_request doesn't wait forever,
add a 'wake_up' when ->reshape_progress has been set to MaxSector
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 2cffc4a0
...@@ -3637,10 +3637,9 @@ static int make_request(struct request_queue *q, struct bio * bi) ...@@ -3637,10 +3637,9 @@ static int make_request(struct request_queue *q, struct bio * bi)
retry: retry:
previous = 0; previous = 0;
prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE);
if (likely(conf->reshape_progress == MaxSector))
disks = conf->raid_disks; disks = conf->raid_disks;
else { prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE);
if (unlikely(conf->reshape_progress != MaxSector)) {
/* spinlock is needed as reshape_progress may be /* spinlock is needed as reshape_progress may be
* 64bit on a 32bit platform, and so it might be * 64bit on a 32bit platform, and so it might be
* possible to see a half-updated value * possible to see a half-updated value
...@@ -3650,7 +3649,6 @@ static int make_request(struct request_queue *q, struct bio * bi) ...@@ -3650,7 +3649,6 @@ static int make_request(struct request_queue *q, struct bio * bi)
* to check again. * to check again.
*/ */
spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock);
disks = conf->raid_disks;
if (mddev->delta_disks < 0 if (mddev->delta_disks < 0
? logical_sector < conf->reshape_progress ? logical_sector < conf->reshape_progress
: logical_sector >= conf->reshape_progress) { : logical_sector >= conf->reshape_progress) {
...@@ -3679,7 +3677,7 @@ static int make_request(struct request_queue *q, struct bio * bi) ...@@ -3679,7 +3677,7 @@ static int make_request(struct request_queue *q, struct bio * bi)
sh = get_active_stripe(conf, new_sector, previous, sh = get_active_stripe(conf, new_sector, previous,
(bi->bi_rw&RWA_MASK)); (bi->bi_rw&RWA_MASK));
if (sh) { if (sh) {
if (unlikely(conf->reshape_progress != MaxSector)) { if (unlikely(previous)) {
/* expansion might have moved on while waiting for a /* expansion might have moved on while waiting for a
* stripe, so we must do the range check again. * stripe, so we must do the range check again.
* Expansion could still move past after this * Expansion could still move past after this
...@@ -3690,10 +3688,9 @@ static int make_request(struct request_queue *q, struct bio * bi) ...@@ -3690,10 +3688,9 @@ static int make_request(struct request_queue *q, struct bio * bi)
*/ */
int must_retry = 0; int must_retry = 0;
spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock);
if ((mddev->delta_disks < 0 if (mddev->delta_disks < 0
? logical_sector >= conf->reshape_progress ? logical_sector >= conf->reshape_progress
: logical_sector < conf->reshape_progress) : logical_sector < conf->reshape_progress)
&& previous)
/* mismatch, need to try again */ /* mismatch, need to try again */
must_retry = 1; must_retry = 1;
spin_unlock_irq(&conf->device_lock); spin_unlock_irq(&conf->device_lock);
...@@ -4977,6 +4974,7 @@ static void end_reshape(raid5_conf_t *conf) ...@@ -4977,6 +4974,7 @@ static void end_reshape(raid5_conf_t *conf)
conf->previous_raid_disks = conf->raid_disks; conf->previous_raid_disks = conf->raid_disks;
conf->reshape_progress = MaxSector; conf->reshape_progress = MaxSector;
spin_unlock_irq(&conf->device_lock); spin_unlock_irq(&conf->device_lock);
wake_up(&conf->wait_for_overlap);
/* read-ahead size must cover two whole stripes, which is /* read-ahead size must cover two whole stripes, which is
* 2 * (datadisks) * chunksize where 'n' is the number of raid devices * 2 * (datadisks) * chunksize where 'n' is the number of raid devices
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment