Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Add a "soft" root option, leaving the curr...



details:   https://anonhg.NetBSD.org/src/rev/dede7007d360
branches:  trunk
changeset: 795199:dede7007d360
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 03 18:55:26 2014 +0000

description:
Add a "soft" root option, leaving the current default as "force root", so
as not to break existing configurations.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

diffs (81 lines):

diff -r 7ad9a6dd2ddd -r dede7007d360 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Thu Apr 03 18:54:10 2014 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Thu Apr 03 18:55:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.307 2014/04/03 15:30:52 christos Exp $    */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.308 2014/04/03 18:55:26 christos Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.307 2014/04/03 15:30:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.308 2014/04/03 18:55:26 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -537,11 +537,10 @@
                        candidate_root = dkwedge_find_by_wname(cname);
                } else
                        candidate_root = rsc->sc_dev;
-#ifndef RAIDFRAME_FORCE_ROOT
-               if (booted_device == NULL
-                   || rf_containsboot(&rsc->sc_r, booted_device))
-#endif
-               booted_device = candidate_root;
+               if (booted_device == NULL ||
+                   rsc->sc_r.root_partition == 1 ||
+                   rf_containsboot(&rsc->sc_r, booted_device))
+                       booted_device = candidate_root;
        } else if (num_root > 1) {
 
                /* 
@@ -3327,6 +3326,10 @@
 rf_print_component_label(RF_ComponentLabel_t *clabel)
 {
        uint64_t numBlocks;
+       static const char *rp[] = {
+           "No", "Force", "Soft", "*invalid*"
+       };
+
 
        numBlocks = rf_component_label_numblocks(clabel);
 
@@ -3343,8 +3346,7 @@
        printf("   RAID Level: %c  blocksize: %d numBlocks: %"PRIu64"\n",
               (char) clabel->parityConfig, clabel->blockSize, numBlocks);
        printf("   Autoconfig: %s\n", clabel->autoconfigure ? "Yes" : "No");
-       printf("   Contains root partition: %s\n",
-              clabel->root_partition ? "Yes" : "No");
+       printf("   Root partition: %s\n", rp[clabel->root_partition & 3]);
        printf("   Last configured as: raid%d\n", clabel->last_unit);
 #if 0
           printf("   Config order: %d\n", clabel->config_order);
@@ -3790,12 +3792,20 @@
 
                rf_markalldirty(raidPtr);
                raidPtr->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;
+               switch (cset->ac->clabel->root_partition) {
+               case 1: /* Force Root */
+               case 2: /* Soft Root: root when boot partition part of raid */
+                       /*
+                        * everything configured just fine.  Make a note
+                        * that this set is eligible to be root,
+                        * or forced to be root
+                        */
+                       cset->rootable = cset->ac->clabel->root_partition;
                        /* XXX do this here? */
-                       raidPtr->root_partition = 1;
+                       raidPtr->root_partition = cset->rootable;
+                       break;
+               default:
+                       break;
                }
        } else {
                raidput(sc);



Home | Main Index | Thread Index | Old Index