Don't let the autodetection code get tripped up by negative mod-counters.

This commit is contained in:
oster 2000-05-29 02:57:34 +00:00
parent c7c33f1747
commit c11100526b
2 changed files with 17 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_disks.c,v 1.29 2000/05/28 22:53:49 oster Exp $ */
/* $NetBSD: rf_disks.c,v 1.30 2000/05/29 02:57:34 oster Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@ -388,6 +388,7 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config)
RF_AutoConfig_t *ac;
int parity_good;
int mod_counter;
int mod_counter_found;
#if DEBUG
printf("Starting autoconfiguration of RAID set...\n");
@ -404,30 +405,21 @@ rf_AutoConfigureDisks(raidPtr, cfgPtr, auto_config)
parity_good = RF_RAID_CLEAN;
/* Check for mod_counters that are too low */
mod_counter = -1;
mod_counter_found = 0;
ac = auto_config;
while(ac!=NULL) {
if (mod_counter_found==0) {
mod_counter = ac->clabel->mod_counter;
mod_counter_found = 1;
} else {
if (ac->clabel->mod_counter > mod_counter) {
mod_counter = ac->clabel->mod_counter;
}
}
ac->flag = 0; /* clear the general purpose flag */
ac = ac->next;
}
if (mod_counter == -1) {
/* mod_counters were all negative!?!?!?
Ok, we can deal with that. */
#if 0
ac = auto_config;
while(ac!=NULL) {
if (ac->clabel->mod_counter > mod_counter) {
mod_counter = ac->clabel->mod_counter;
}
ac = ac->next;
}
#endif
}
for (r = 0; r < raidPtr->numRow; r++) {
numFailuresThisRow = 0;
for (c = 0; c < raidPtr->numCol; c++) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_netbsdkintf.c,v 1.86 2000/05/28 05:23:41 oster Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.87 2000/05/29 02:57:35 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -3007,6 +3007,7 @@ rf_have_enough_components(cset)
int num_cols;
int num_missing;
int mod_counter;
int mod_counter_found;
/* check to see that we have enough 'live' components
of this set. If so, we can configure it if necessary */
@ -3018,12 +3019,17 @@ rf_have_enough_components(cset)
/* Determine what the mod_counter is supposed to be for this set. */
mod_counter = -1;
mod_counter_found = 0;
ac = cset->ac;
while(ac!=NULL) {
if (mod_counter_found==0) {
mod_counter = ac->clabel->mod_counter;
mod_counter_found = 1;
} else {
if (ac->clabel->mod_counter > mod_counter) {
mod_counter = ac->clabel->mod_counter;
}
}
ac = ac->next;
}