diff options
| author | christos <christos@NetBSD.org> | 2016-04-27 02:24:06 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2016-04-27 02:24:06 +0000 |
| commit | a1703be373973b8d0f2a56c1ce49706ed7df9034 (patch) | |
| tree | 7d540fe553cd36f38659fba2a0611f0961d62577 /sys/dev/raidframe | |
| parent | 8a85ea28dda96eb4ec9dd4679ac5c3944206dd8f (diff) | |
Extend the "a" partition hack to also mean the first partition on the raid,
for non-disklabel based raidframe disks that need root.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 014ca7c8563..b9c22f963b1 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -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 @@ int rf_kdebug_level = 0; #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 @@ rf_buildroothack(RF_ConfigSet_t *config_sets) 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 @@ rf_buildroothack(RF_ConfigSet_t *config_sets) 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 |
