Module Name: src Committed By: christos Date: Wed Apr 27 02:24:06 UTC 2016
Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Extend the "a" partition hack to also mean the first partition on the raid, for non-disklabel based raidframe disks that need root. To generate a diff of this commit: cvs rdiff -u -r1.343 -r1.344 src/sys/dev/raidframe/rf_netbsdkintf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.343 src/sys/dev/raidframe/rf_netbsdkintf.c:1.344 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.343 Thu Jan 7 09:15:26 2016 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Apr 26 22:24:06 2016 @@ -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_ 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_ 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