Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe In the event that an up-to-date component ...



details:   https://anonhg.NetBSD.org/src/rev/61d010d7937e
branches:  trunk
changeset: 486798:61d010d7937e
user:      oster <oster%NetBSD.org@localhost>
date:      Sun May 28 22:53:49 2000 +0000

description:
In the event that an up-to-date component cannot be located for a specific
position, see if there is a failed component still hanging around that
we can use instead (but still mark it as failed).  This leads to more
reasonable behaviour (and fewer surprises!) when autoconfiguring and
failed (or previously failed) components are still on the system.

diffstat:

 sys/dev/raidframe/rf_disks.c  |  72 +++++++++++++++++++++++++++++++++---------
 sys/dev/raidframe/rf_netbsd.h |   3 +-
 2 files changed, 58 insertions(+), 17 deletions(-)

diffs (133 lines):

diff -r 314fe76ea39d -r 61d010d7937e sys/dev/raidframe/rf_disks.c
--- a/sys/dev/raidframe/rf_disks.c      Sun May 28 22:38:54 2000 +0000
+++ b/sys/dev/raidframe/rf_disks.c      Sun May 28 22:53:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_disks.c,v 1.28 2000/05/28 05:23:42 oster Exp $      */
+/*     $NetBSD: rf_disks.c,v 1.29 2000/05/28 22:53:49 oster Exp $      */
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -410,8 +410,10 @@
                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. */
@@ -425,21 +427,6 @@
                }
 #endif
        }
-       /* close the device for the ones that don't match */
-
-       ac = auto_config;
-       while(ac!=NULL) {
-               if (ac->clabel->mod_counter != mod_counter) {
-                       VOP_CLOSE(ac->vp, FREAD, NOCRED, 0);
-                       vput(ac->vp);
-                       ac->vp = NULL;
-#if DEBUG 
-                       printf("Ignoring %s due to low mod_counter.\n",
-                              ac->devname);
-#endif
-               }
-               ac = ac->next;
-       }
 
        for (r = 0; r < raidPtr->numRow; r++) {
                numFailuresThisRow = 0;
@@ -460,6 +447,9 @@
                                    (ac->clabel->column == c) &&
                                    (ac->clabel->mod_counter == mod_counter)) {
                                        /* it's this one... */
+                                       /* flag it as 'used', so we don't
+                                          free it later. */
+                                       ac->flag = 1;
 #if DEBUG
                                        printf("Found: %s at %d,%d\n",
                                               ac->devname,r,c);
@@ -470,6 +460,40 @@
                                ac=ac->next;
                        }
 
+                       if (ac==NULL) {
+                               /* we didn't find an exact match with a 
+                                  correct mod_counter above... can we
+                                  find one with an incorrect mod_counter
+                                  to use instead?  (this one, if we find
+                                  it, will be marked as failed once the 
+                                  set configures) 
+                               */
+
+                               ac = auto_config;
+                               while(ac!=NULL) {
+                                       if (ac->clabel==NULL) {
+                                               /* big-time bad news. */
+                                               goto fail;
+                                       }
+                                       if ((ac->clabel->row == r) &&
+                                           (ac->clabel->column == c)) {
+                                               /* it's this one... 
+                                                  flag it as 'used', so we 
+                                                  don't free it later. */
+                                               ac->flag = 1;
+#if DEBUG
+                                               printf("Found(low mod_counter): %s at %d,%d\n",
+                                                      ac->devname,r,c);
+#endif
+                                               
+                                               break;
+                                       }
+                                       ac=ac->next;
+                               }
+                       }
+
+
+
                        if (ac!=NULL) {
                                /* Found it.  Configure it.. */
                                diskPtr->blockSize = ac->clabel->blockSize;
@@ -545,6 +569,22 @@
                        raidPtr->status[r] = rf_rs_degraded;
        }
 
+       /* close the device for the ones that didn't get used */
+
+       ac = auto_config;
+       while(ac!=NULL) {
+               if (ac->flag == 0) {
+                       VOP_CLOSE(ac->vp, FREAD, NOCRED, 0);
+                       vput(ac->vp);
+                       ac->vp = NULL;
+#if DEBUG 
+                       printf("Released %s from auto-config set.\n",
+                              ac->devname);
+#endif
+               }
+               ac = ac->next;
+       }
+
        raidPtr->mod_counter = mod_counter;
 
        /* note the state of the parity, if any */
diff -r 314fe76ea39d -r 61d010d7937e sys/dev/raidframe/rf_netbsd.h
--- a/sys/dev/raidframe/rf_netbsd.h     Sun May 28 22:38:54 2000 +0000
+++ b/sys/dev/raidframe/rf_netbsd.h     Sun May 28 22:53:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsd.h,v 1.11 2000/03/27 03:01:33 oster Exp $     */
+/*     $NetBSD: rf_netbsd.h,v 1.12 2000/05/28 22:53:49 oster Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -121,6 +121,7 @@
 /* XXX probably belongs in a different .h file. */
 typedef struct RF_AutoConfig_s {
        char devname[56];       /* the name of this component */
+       int flag;               /* a general-purpose flag */
        dev_t dev;              /* the device for this component */
        struct vnode *vp;       /* Mr. Vnode Pointer */
        RF_ComponentLabel_t *clabel;  /* the label */



Home | Main Index | Thread Index | Old Index