Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Extend the "a" partition hack to also mean...



details:   https://anonhg.NetBSD.org/src/rev/c54a866786e7
branches:  trunk
changeset: 815043:c54a866786e7
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 27 02:24:06 2016 +0000

description:
Extend the "a" partition hack to also mean the first partition on the raid,
for non-disklabel based raidframe disks that need root.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diffs (72 lines):

diff -r 540b695219b2 -r c54a866786e7 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Wed Apr 27 02:19:12 2016 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Wed Apr 27 02:24:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.343 2016/01/07 14:15:26 christos Exp $    */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.344 2016/04/27 02:24:06 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.343 2016/01/07 14:15:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.344 2016/04/27 02:24:06 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -161,6 +161,10 @@
 #define db1_printf(a) { }
 #endif                         /* DEBUG */
 
+#ifdef DEBUG_ROOT
+#define DPRINTF(a, ...) printf(a, __VA_ARGS__)
+#endif
+
 #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0)
 static rf_declare_mutex2(rf_sparet_wait_mutex);
 static rf_declare_cond2(rf_sparet_wait_cv);
@@ -537,12 +541,32 @@
                device_t candidate_root;
                if (dksc->sc_dkdev.dk_nwedges != 0) {
                        char cname[sizeof(cset->ac->devname)];
-                       /* XXX: assume 'a' */
+                       /* XXX: assume partition 'a' first */
                        snprintf(cname, sizeof(cname), "%s%c",
                            device_xname(dksc->sc_dev), 'a');
                        candidate_root = dkwedge_find_by_wname(cname);
+                       DPRINTF("%s: candidate wedge root=%s\n", __func__,
+                           cname);
+                       if (candidate_root == NULL) {
+                               /*
+                                * If that is not found, because we don't use
+                                * disklabel, return the first dk child
+                                * XXX: we can skip the 'a' check above
+                                * and always do this...
+                                */
+                               size_t i = 0;
+                               candidate_root = dkwedge_find_by_parent(
+                                   device_xname(dksc->sc_dev), &i);
+                       }
+                       DPRINTF("%s: candidate wedge root=%p\n", __func__,
+                           candidate_root);
                } else
                        candidate_root = dksc->sc_dev;
+               DPRINTF("%s: candidate root=%p\n", __func__, candidate_root);
+               DPRINTF("%s: booted_device=%p root_partition=%d "
+                  "contains_boot=%d\n", __func__, booted_device,
+                  rsc->sc_r.root_partition,
+                  rf_containsboot(&rsc->sc_r, booted_device));
                if (booted_device == NULL ||
                    rsc->sc_r.root_partition == 1 ||
                    rf_containsboot(&rsc->sc_r, booted_device)) {
@@ -550,6 +574,8 @@
                        booted_partition = 0;   /* XXX assume 'a' */
                }
        } else if (num_root > 1) {
+               DPRINTF("%s: many roots=%d, %p\n", __func__, num_root,
+                   booted_device);
 
                /* 
                 * Maybe the MD code can help. If it cannot, then



Home | Main Index | Thread Index | Old Index