tech-kern archive

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

patch: debug instrumentation for dev/raidframe/rf_netbsdkintf.c



Here is some instrumentation I found useful during my recent debugging.
If there are no objections, I'd like to commit soon.

The change to rf_containsroot() simplifies the second DPRINTF that I added.

Index: rf_netbsdkintf.c
===================================================================
RCS file: /cvsroot/src/sys/dev/raidframe/rf_netbsdkintf.c,v
retrieving revision 1.356
diff -u -r1.356 rf_netbsdkintf.c
--- rf_netbsdkintf.c	23 Jan 2018 22:42:29 -0000	1.356
+++ rf_netbsdkintf.c	20 Jan 2019 22:32:14 -0000
@@ -472,6 +472,9 @@
 	const char *bootname = device_xname(bdv);
 	size_t len = strlen(bootname);
 
+	if (bdv == NULL)
+		return 0;
+
 	for (int col = 0; col < r->numCol; col++) {
 		const char *devname = r->Disks[col].devname;
 		devname += sizeof("/dev/") - 1;
@@ -509,8 +512,8 @@
 		    cset->ac->clabel->autoconfigure == 1) {
 			sc = rf_auto_config_set(cset);
 			if (sc != NULL) {
-				aprint_debug("raid%d: configured ok\n",
-				    sc->sc_unit);
+				aprint_debug("raid%d: configured ok, rootable %d\n",
+				    sc->sc_unit, cset->rootable);
 				if (cset->rootable) {
 					rsc = sc;
 					num_root++;
@@ -534,8 +537,10 @@
 	/* if the user has specified what the root device should be
 	   then we don't touch booted_device or boothowto... */
 
-	if (rootspec != NULL)
+	if (rootspec != NULL) {
+		DPRINTF("%s: rootspec %s\n", __func__, rootspec);
 		return;
+	}
 
 	/* we found something bootable... */
 
@@ -577,9 +582,9 @@
 			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));
+			"contains_boot=%d",
+		    __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)) {


Home | Main Index | Thread Index | Old Index