imsm: handle degraded->normal transitions in set_disk

Removes the need for the call to ->set_array_state when sync_action
transitions from 'recover' to 'idle'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2008-07-24 17:26:23 -07:00
parent 8273f55e4f
commit 5802a8118e
2 changed files with 16 additions and 6 deletions

View File

@ -277,7 +277,6 @@ static int read_and_act(struct active_array *a)
if (! (mdi->curr_state & DS_INSYNC))
check_degraded = 1;
}
a->container->ss->set_array_state(a, 0);
}
for (mdi = a->info.devs ; mdi ; mdi = mdi->next) {

View File

@ -1865,26 +1865,37 @@ static void imsm_set_disk(struct active_array *a, int n, int state)
disk = get_imsm_disk(super->mpb, get_imsm_disk_idx(map, n));
/* check if we have seen this failure before */
/* check for new failures */
status = __le32_to_cpu(disk->status);
if ((state & DS_FAULTY) && !(status & FAILED_DISK)) {
status |= FAILED_DISK;
disk->status = __cpu_to_le32(status);
new_failure = 1;
super->updates_pending++;
}
/**
* the number of failures have changed, count up 'failed' to determine
/* the number of failures have changed, count up 'failed' to determine
* degraded / failed status
*/
if (new_failure && map->map_state != IMSM_T_STATE_FAILED)
failed = imsm_count_failed(super->mpb, map);
/* determine map_state based on failed or in_sync count */
if (failed)
map->map_state = imsm_check_degraded(super->mpb, inst, failed);
else if (map->map_state == IMSM_T_STATE_DEGRADED) {
struct mdinfo *d;
int working = 0;
if (new_failure)
super->updates_pending++;
for (d = a->info.devs ; d ; d = d->next)
if (d->curr_state & DS_INSYNC)
working++;
if (working == a->info.array.raid_disks) {
map->map_state = IMSM_T_STATE_NORMAL;
super->updates_pending++;
}
}
}
static int store_imsm_mpb(int fd, struct intel_super *super)