Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe - cleanup of more component label code



details:   https://anonhg.NetBSD.org/src/rev/207fbae7d6e5
branches:  trunk
changeset: 482839:207fbae7d6e5
user:      oster <oster%NetBSD.org@localhost>
date:      Wed Feb 23 02:04:21 2000 +0000

description:
- cleanup of more component label code
- make current default label values available everywhere
- make sure numBlocks and blockSize in component labels get initialized
for all component labels
- check for component size to be smaller than or equal to the partition size
when autoconfiguring

diffstat:

 sys/dev/raidframe/rf_driver.c      |  10 +++++++++-
 sys/dev/raidframe/rf_netbsdkintf.c |  27 +++++++++++++++++++--------
 sys/dev/raidframe/rf_raid.h        |  16 +++++++++++++++-
 3 files changed, 43 insertions(+), 10 deletions(-)

diffs (151 lines):

diff -r fd79230a46b3 -r 207fbae7d6e5 sys/dev/raidframe/rf_driver.c
--- a/sys/dev/raidframe/rf_driver.c     Wed Feb 23 02:03:03 2000 +0000
+++ b/sys/dev/raidframe/rf_driver.c     Wed Feb 23 02:04:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_driver.c,v 1.28 2000/02/13 04:53:57 oster Exp $     */
+/*     $NetBSD: rf_driver.c,v 1.29 2000/02/23 02:04:21 oster Exp $     */
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -519,6 +519,14 @@
        raidPtr->copyback_in_progress = 0;
        raidPtr->parity_rewrite_in_progress = 0;
        raidPtr->recon_in_progress = 0;
+       raidPtr->maxOutstanding = cfgPtr->maxOutstandingDiskReqs;
+
+       /* autoconfigure and root_partition will actually get filled in 
+          after the config is done */
+       raidPtr->autoconfigure = 0;
+       raidPtr->root_partition = 0;
+       raidPtr->last_unit = raidPtr->raidid;
+       raidPtr->config_order = 0;
 
        if (rf_keepAccTotals) {
                raidPtr->keep_acc_totals = 1;
diff -r fd79230a46b3 -r 207fbae7d6e5 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Wed Feb 23 02:03:03 2000 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Wed Feb 23 02:04:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.53 2000/02/22 23:13:15 oster Exp $        */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.54 2000/02/23 02:04:21 oster Exp $        */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -660,6 +660,9 @@
                   Device shutdown has taken care of setting the 
                   clean bits if RAIDF_INITED is not set 
                   mark things as clean... */
+#ifdef DEBUG
+               printf("Last one on raid%d.  Updating status.\n",unit);
+#endif
                rf_update_component_labels( raidPtrs[unit] );
        }
 
@@ -1078,7 +1081,6 @@
                        for(column=0;column<raidPtr->numCol;column++) {
                                diskPtr = &raidPtr->Disks[row][column];
                                ci_label.blockSize = diskPtr->blockSize;
-                               ci_label.numBlocks = diskPtr->numBlocks;
                                ci_label.partitionSize = diskPtr->partitionSize;
                                ci_label.column = column;
                                raidwrite_component_label( 
@@ -2596,7 +2598,7 @@
                        if (!raidread_component_label(dev, vp, clabel)) {
                                /* Got the label.  Does it look reasonable? */
                                if (rf_reasonable_label(clabel) &&
-                                   (clabel->partitionSize == 
+                                   (clabel->partitionSize <= 
                                     label.d_partitions[i].p_size)) {
 #if DEBUG
                                        printf("Component on: %s%c: %d\n", 
@@ -2763,6 +2765,7 @@
        /* If this one matches the *first* one in the set, that's good
           enough, since the other members of the set would have been
           through here too... */
+       /* note that we are not checking partitionSize here.. */
 
        clabel1 = cset->ac->clabel;
        clabel2 = ac->clabel;
@@ -2902,6 +2905,7 @@
        dev_t dev;
        int row, column;
 
+       raidPtr->autoconfigure = new_value;
        for(row=0; row<raidPtr->numRow; row++) {
                for(column=0; column<raidPtr->numCol; column++) {
                        dev = raidPtr->Disks[row][column].dev;
@@ -2924,6 +2928,7 @@
        dev_t dev;
        int row, column;
 
+       raidPtr->root_partition = new_value;
        for(row=0; row<raidPtr->numRow; row++) {
                for(column=0; column<raidPtr->numCol; column++) {
                        dev = raidPtr->Disks[row][column].dev;
@@ -2993,14 +2998,17 @@
        clabel->sectPerSU = raidPtr->Layout.sectorsPerStripeUnit;
        clabel->SUsPerPU = raidPtr->Layout.SUsPerPU;
        clabel->SUsPerRU = raidPtr->Layout.SUsPerRU;
+
+       clabel->blockSize = raidPtr->bytesPerSector;
+       clabel->numBlocks = raidPtr->sectorsPerDisk;
+
        /* XXX not portable */
        clabel->parityConfig = raidPtr->Layout.map->parityConfig;
-       /* XXX THIS SHOULD BE SET RIGHT!! */
-       clabel->maxOutstanding = 100;
-       clabel->autoconfigure = 0;
-       clabel->root_partition = 0;
+       clabel->maxOutstanding = raidPtr->maxOutstanding;
+       clabel->autoconfigure = raidPtr->autoconfigure;
+       clabel->root_partition = raidPtr->root_partition;
        clabel->last_unit = raidPtr->raidid;
-       clabel->config_order = 0;
+       clabel->config_order = raidPtr->config_order;
 }
 
 int
@@ -3086,10 +3094,13 @@
                        printf("init returned: %d\n",retcode);
                }
                rf_markalldirty( raidPtrs[raidID] );
+               raidPtrs[raidID]->autoconfigure = 1; /* XXX do this here? */
                if (cset->ac->clabel->root_partition==1) {
                        /* everything configured just fine.  Make a note
                           that this set is eligible to be root. */
                        cset->rootable = 1;
+                       /* XXX do this here? */
+                       raidPtrs[raidID]->root_partition = 1; 
                }
        }
 
diff -r fd79230a46b3 -r 207fbae7d6e5 sys/dev/raidframe/rf_raid.h
--- a/sys/dev/raidframe/rf_raid.h       Wed Feb 23 02:03:03 2000 +0000
+++ b/sys/dev/raidframe/rf_raid.h       Wed Feb 23 02:04:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_raid.h,v 1.9 2000/02/13 04:53:57 oster Exp $        */
+/*     $NetBSD: rf_raid.h,v 1.10 2000/02/23 02:04:21 oster Exp $       */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -142,6 +142,20 @@
                                   simultaneously (high-level - not a 
                                   per-component limit)*/
 
+       int maxOutstanding;   /* maxOutstanding requests (per-component) */
+       int autoconfigure;    /* automatically configure this RAID set. 
+                                0 == no, 1 == yes */
+       int root_partition;   /* Use this set as /
+                                0 == no, 1 == yes*/
+       int last_unit;        /* last unit number (e.g. 0 for /dev/raid0) 
+                                of this component.  Used for autoconfigure
+                                only. */
+       int config_order;     /* 0 .. n.  The order in which the component
+                                should be auto-configured.  E.g. 0 is will 
+                                done first, (and would become raid0).
+                                This may be in conflict with last_unit!!?! */
+                             /* Not currently used. */
+
        /*
          * Cleanup stuff
          */



Home | Main Index | Thread Index | Old Index