Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Sep 2012 08:42:40 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r240552 - stable/9/sys/geom/raid
Message-ID:  <201209160842.q8G8gelW043344@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Sep 16 08:42:40 2012
New Revision: 240552
URL: http://svn.freebsd.org/changeset/base/240552

Log:
  MFC r240465:
  Add global and per-module sysctls/tunables to enable/disable metadata taste.
  That should help to handle some cases when disk has some RAID metadata that
  should be ignored, especially during boot.

Modified:
  stable/9/sys/geom/raid/g_raid.c
  stable/9/sys/geom/raid/g_raid.h
  stable/9/sys/geom/raid/md_ddf.c
  stable/9/sys/geom/raid/md_intel.c
  stable/9/sys/geom/raid/md_jmicron.c
  stable/9/sys/geom/raid/md_nvidia.c
  stable/9/sys/geom/raid/md_promise.c
  stable/9/sys/geom/raid/md_sii.c
  stable/9/sys/geom/raid/tr_concat.c
  stable/9/sys/geom/raid/tr_raid0.c
  stable/9/sys/geom/raid/tr_raid1.c
  stable/9/sys/geom/raid/tr_raid1e.c
  stable/9/sys/geom/raid/tr_raid5.c
Directory Properties:
  stable/9/share/man/man4/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/g_raid.c
==============================================================================
--- stable/9/sys/geom/raid/g_raid.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/g_raid.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -52,6 +52,10 @@ static MALLOC_DEFINE(M_RAID, "raid_data"
 
 SYSCTL_DECL(_kern_geom);
 SYSCTL_NODE(_kern_geom, OID_AUTO, raid, CTLFLAG_RW, 0, "GEOM_RAID stuff");
+int g_raid_enable = 1;
+TUNABLE_INT("kern.geom.raid.enable", &g_raid_enable);
+SYSCTL_INT(_kern_geom_raid, OID_AUTO, enable, CTLFLAG_RW,
+    &g_raid_enable, 0, "Enable on-disk metadata taste");
 u_int g_raid_aggressive_spare = 0;
 TUNABLE_INT("kern.geom.raid.aggressive_spare", &g_raid_aggressive_spare);
 SYSCTL_UINT(_kern_geom_raid, OID_AUTO, aggressive_spare, CTLFLAG_RW,
@@ -1920,6 +1924,8 @@ int g_raid_start_volume(struct g_raid_vo
 
 	G_RAID_DEBUG1(2, vol->v_softc, "Starting volume %s.", vol->v_name);
 	LIST_FOREACH(class, &g_raid_tr_classes, trc_list) {
+		if (!class->trc_enable)
+			continue;
 		G_RAID_DEBUG1(2, vol->v_softc,
 		    "Tasting volume %s for %s transformation.",
 		    vol->v_name, class->name);
@@ -2142,6 +2148,8 @@ g_raid_taste(struct g_class *mp, struct 
 
 	g_topology_assert();
 	g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name);
+	if (!g_raid_enable)
+		return (NULL);
 	G_RAID_DEBUG(2, "Tasting provider %s.", pp->name);
 
 	gp = g_new_geomf(mp, "raid:taste");
@@ -2154,6 +2162,8 @@ g_raid_taste(struct g_class *mp, struct 
 
 	geom = NULL;
 	LIST_FOREACH(class, &g_raid_md_classes, mdc_list) {
+		if (!class->mdc_enable)
+			continue;
 		G_RAID_DEBUG(2, "Tasting provider %s for %s metadata.",
 		    pp->name, class->name);
 		obj = (void *)kobj_create((kobj_class_t)class, M_RAID,

Modified: stable/9/sys/geom/raid/g_raid.h
==============================================================================
--- stable/9/sys/geom/raid/g_raid.h	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/g_raid.h	Sun Sep 16 08:42:40 2012	(r240552)
@@ -33,6 +33,9 @@
 #include <sys/kobj.h>
 #include <sys/bio.h>
 #include <sys/time.h>
+#ifdef _KERNEL
+#include <sys/sysctl.h>
+#endif
 
 #define	G_RAID_CLASS_NAME	"RAID"
 
@@ -51,6 +54,7 @@ struct g_raid_tr_object;
 #ifdef _KERNEL
 extern u_int g_raid_aggressive_spare;
 extern u_int g_raid_debug;
+extern int g_raid_enable;
 extern int g_raid_read_err_thresh;
 extern u_int g_raid_start_timeout;
 extern struct g_class g_raid_class;
@@ -322,11 +326,14 @@ struct g_raid_softc {
 };
 #define	sc_name	sc_geom->name
 
+SYSCTL_DECL(_kern_geom_raid);
+
 /*
  * KOBJ parent class of metadata processing modules.
  */
 struct g_raid_md_class {
 	KOBJ_CLASS_FIELDS;
+	int		 mdc_enable;
 	int		 mdc_priority;
 	LIST_ENTRY(g_raid_md_class) mdc_list;
 };
@@ -342,20 +349,29 @@ struct g_raid_md_object {
 
 int g_raid_md_modevent(module_t, int, void *);
 
-#define	G_RAID_MD_DECLARE(name)					\
-    static moduledata_t name##_mod = {				\
-	#name,							\
+#define	G_RAID_MD_DECLARE(name, label)				\
+    static moduledata_t g_raid_md_##name##_mod = {		\
+	"g_raid_md_" __XSTRING(name),				\
 	g_raid_md_modevent,					\
-	&name##_class						\
+	&g_raid_md_##name##_class				\
     };								\
-    DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND);	\
-    MODULE_DEPEND(name, geom_raid, 0, 0, 0)
+    DECLARE_MODULE(g_raid_md_##name, g_raid_md_##name##_mod,	\
+	SI_SUB_DRIVERS, SI_ORDER_SECOND);			\
+    MODULE_DEPEND(g_raid_md_##name, geom_raid, 0, 0, 0);	\
+    SYSCTL_NODE(_kern_geom_raid, OID_AUTO, name, CTLFLAG_RD,	\
+	NULL, label " metadata module");			\
+    SYSCTL_INT(_kern_geom_raid_##name, OID_AUTO, enable,	\
+	CTLFLAG_RW, &g_raid_md_##name##_class.mdc_enable, 0,	\
+	"Enable " label " metadata format taste");		\
+    TUNABLE_INT("kern.geom.raid." __XSTRING(name) ".enable",	\
+	&g_raid_md_##name##_class.mdc_enable)
 
 /*
  * KOBJ parent class of data transformation modules.
  */
 struct g_raid_tr_class {
 	KOBJ_CLASS_FIELDS;
+	int		 trc_enable;
 	int		 trc_priority;
 	LIST_ENTRY(g_raid_tr_class) trc_list;
 };
@@ -371,14 +387,22 @@ struct g_raid_tr_object {
 
 int g_raid_tr_modevent(module_t, int, void *);
 
-#define	G_RAID_TR_DECLARE(name)					\
-    static moduledata_t name##_mod = {				\
-	#name,							\
+#define	G_RAID_TR_DECLARE(name, label)				\
+    static moduledata_t g_raid_tr_##name##_mod = {		\
+	"g_raid_tr_" __XSTRING(name),				\
 	g_raid_tr_modevent,					\
-	&name##_class						\
+	&g_raid_tr_##name##_class				\
     };								\
-    DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);	\
-    MODULE_DEPEND(name, geom_raid, 0, 0, 0)
+    DECLARE_MODULE(g_raid_tr_##name, g_raid_tr_##name##_mod,	\
+	SI_SUB_DRIVERS, SI_ORDER_FIRST);			\
+    MODULE_DEPEND(g_raid_tr_##name, geom_raid, 0, 0, 0);	\
+    SYSCTL_NODE(_kern_geom_raid, OID_AUTO, name, CTLFLAG_RD,	\
+	NULL, label " transformation module");			\
+    SYSCTL_INT(_kern_geom_raid_##name, OID_AUTO, enable,	\
+	CTLFLAG_RW, &g_raid_tr_##name##_class.trc_enable, 0,	\
+	"Enable " label " transformation module taste");	\
+    TUNABLE_INT("kern.geom.raid." __XSTRING(name) ".enable",	\
+	&g_raid_tr_##name##_class.trc_enable)
 
 const char * g_raid_volume_level2str(int level, int qual);
 int g_raid_volume_str2level(const char *str, int *level, int *qual);

Modified: stable/9/sys/geom/raid/md_ddf.c
==============================================================================
--- stable/9/sys/geom/raid/md_ddf.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/md_ddf.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -125,6 +125,7 @@ static struct g_raid_md_class g_raid_md_
 	"DDF",
 	g_raid_md_ddf_methods,
 	sizeof(struct g_raid_md_ddf_object),
+	.mdc_enable = 1,
 	.mdc_priority = 100
 };
 
@@ -3065,4 +3066,4 @@ g_raid_md_free_ddf(struct g_raid_md_obje
 	return (0);
 }
 
-G_RAID_MD_DECLARE(g_raid_md_ddf);
+G_RAID_MD_DECLARE(ddf, "DDF");

Modified: stable/9/sys/geom/raid/md_intel.c
==============================================================================
--- stable/9/sys/geom/raid/md_intel.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/md_intel.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -224,6 +224,7 @@ static struct g_raid_md_class g_raid_md_
 	"Intel",
 	g_raid_md_intel_methods,
 	sizeof(struct g_raid_md_intel_object),
+	.mdc_enable = 1,
 	.mdc_priority = 100
 };
 
@@ -2432,4 +2433,4 @@ g_raid_md_free_intel(struct g_raid_md_ob
 	return (0);
 }
 
-G_RAID_MD_DECLARE(g_raid_md_intel);
+G_RAID_MD_DECLARE(intel, "Intel");

Modified: stable/9/sys/geom/raid/md_jmicron.c
==============================================================================
--- stable/9/sys/geom/raid/md_jmicron.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/md_jmicron.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -132,6 +132,7 @@ static struct g_raid_md_class g_raid_md_
 	"JMicron",
 	g_raid_md_jmicron_methods,
 	sizeof(struct g_raid_md_jmicron_object),
+	.mdc_enable = 1,
 	.mdc_priority = 100
 };
 
@@ -1581,4 +1582,4 @@ g_raid_md_free_jmicron(struct g_raid_md_
 	return (0);
 }
 
-G_RAID_MD_DECLARE(g_raid_md_jmicron);
+G_RAID_MD_DECLARE(jmicron, "JMicron");

Modified: stable/9/sys/geom/raid/md_nvidia.c
==============================================================================
--- stable/9/sys/geom/raid/md_nvidia.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/md_nvidia.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -143,6 +143,7 @@ static struct g_raid_md_class g_raid_md_
 	"NVIDIA",
 	g_raid_md_nvidia_methods,
 	sizeof(struct g_raid_md_nvidia_object),
+	.mdc_enable = 1,
 	.mdc_priority = 100
 };
 
@@ -1600,4 +1601,4 @@ g_raid_md_free_nvidia(struct g_raid_md_o
 	return (0);
 }
 
-G_RAID_MD_DECLARE(g_raid_md_nvidia);
+G_RAID_MD_DECLARE(nvidia, "NVIDIA");

Modified: stable/9/sys/geom/raid/md_promise.c
==============================================================================
--- stable/9/sys/geom/raid/md_promise.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/md_promise.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -171,6 +171,7 @@ static struct g_raid_md_class g_raid_md_
 	"Promise",
 	g_raid_md_promise_methods,
 	sizeof(struct g_raid_md_object),
+	.mdc_enable = 1,
 	.mdc_priority = 100
 };
 
@@ -1967,4 +1968,4 @@ g_raid_md_free_promise(struct g_raid_md_
 	return (0);
 }
 
-G_RAID_MD_DECLARE(g_raid_md_promise);
+G_RAID_MD_DECLARE(promise, "Promise");

Modified: stable/9/sys/geom/raid/md_sii.c
==============================================================================
--- stable/9/sys/geom/raid/md_sii.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/md_sii.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -140,6 +140,7 @@ static struct g_raid_md_class g_raid_md_
 	"SiI",
 	g_raid_md_sii_methods,
 	sizeof(struct g_raid_md_sii_object),
+	.mdc_enable = 1,
 	.mdc_priority = 100
 };
 
@@ -1688,4 +1689,4 @@ g_raid_md_free_sii(struct g_raid_md_obje
 	return (0);
 }
 
-G_RAID_MD_DECLARE(g_raid_md_sii);
+G_RAID_MD_DECLARE(sii, "SiI");

Modified: stable/9/sys/geom/raid/tr_concat.c
==============================================================================
--- stable/9/sys/geom/raid/tr_concat.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/tr_concat.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -73,6 +73,7 @@ static struct g_raid_tr_class g_raid_tr_
 	"CONCAT",
 	g_raid_tr_concat_methods,
 	sizeof(struct g_raid_tr_concat_object),
+	.trc_enable = 1,
 	.trc_priority = 50
 };
 
@@ -340,4 +341,4 @@ g_raid_tr_free_concat(struct g_raid_tr_o
 	return (0);
 }
 
-G_RAID_TR_DECLARE(g_raid_tr_concat);
+G_RAID_TR_DECLARE(concat, "CONCAT");

Modified: stable/9/sys/geom/raid/tr_raid0.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid0.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/tr_raid0.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -73,6 +73,7 @@ static struct g_raid_tr_class g_raid_tr_
 	"RAID0",
 	g_raid_tr_raid0_methods,
 	sizeof(struct g_raid_tr_raid0_object),
+	.trc_enable = 1,
 	.trc_priority = 100
 };
 
@@ -323,4 +324,4 @@ g_raid_tr_free_raid0(struct g_raid_tr_ob
 	return (0);
 }
 
-G_RAID_TR_DECLARE(g_raid_tr_raid0);
+G_RAID_TR_DECLARE(raid0, "RAID0");

Modified: stable/9/sys/geom/raid/tr_raid1.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid1.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/tr_raid1.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -42,9 +42,7 @@ __FBSDID("$FreeBSD$");
 #include "geom/raid/g_raid.h"
 #include "g_raid_tr_if.h"
 
-SYSCTL_DECL(_kern_geom_raid);
-SYSCTL_NODE(_kern_geom_raid, OID_AUTO, raid1, CTLFLAG_RW, 0,
-    "RAID1 parameters");
+SYSCTL_DECL(_kern_geom_raid_raid1);
 
 #define RAID1_REBUILD_SLAB	(1 << 20) /* One transation in a rebuild */
 static int g_raid1_rebuild_slab = RAID1_REBUILD_SLAB;
@@ -131,6 +129,7 @@ static struct g_raid_tr_class g_raid_tr_
 	"RAID1",
 	g_raid_tr_raid1_methods,
 	sizeof(struct g_raid_tr_raid1_object),
+	.trc_enable = 1,
 	.trc_priority = 100
 };
 
@@ -996,4 +995,4 @@ g_raid_tr_free_raid1(struct g_raid_tr_ob
 	return (0);
 }
 
-G_RAID_TR_DECLARE(g_raid_tr_raid1);
+G_RAID_TR_DECLARE(raid1, "RAID1");

Modified: stable/9/sys/geom/raid/tr_raid1e.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid1e.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/tr_raid1e.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$");
 
 #define N	2
 
-SYSCTL_DECL(_kern_geom_raid);
-SYSCTL_NODE(_kern_geom_raid, OID_AUTO, raid1e, CTLFLAG_RW, 0,
-    "RAID1E parameters");
+SYSCTL_DECL(_kern_geom_raid_raid1e);
 
 #define RAID1E_REBUILD_SLAB	(1 << 20) /* One transation in a rebuild */
 static int g_raid1e_rebuild_slab = RAID1E_REBUILD_SLAB;
@@ -135,6 +133,7 @@ static struct g_raid_tr_class g_raid_tr_
 	"RAID1E",
 	g_raid_tr_raid1e_methods,
 	sizeof(struct g_raid_tr_raid1e_object),
+	.trc_enable = 1,
 	.trc_priority = 200
 };
 
@@ -1236,4 +1235,4 @@ g_raid_tr_free_raid1e(struct g_raid_tr_o
 	return (0);
 }
 
-G_RAID_TR_DECLARE(g_raid_tr_raid1e);
+G_RAID_TR_DECLARE(raid1e, "RAID1E");

Modified: stable/9/sys/geom/raid/tr_raid5.c
==============================================================================
--- stable/9/sys/geom/raid/tr_raid5.c	Sun Sep 16 08:09:10 2012	(r240551)
+++ stable/9/sys/geom/raid/tr_raid5.c	Sun Sep 16 08:42:40 2012	(r240552)
@@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$");
 #include "geom/raid/g_raid.h"
 #include "g_raid_tr_if.h"
 
-SYSCTL_DECL(_kern_geom_raid);
-
 static MALLOC_DEFINE(M_TR_RAID5, "tr_raid5_data", "GEOM_RAID RAID5 data");
 
 #define TR_RAID5_NONE 0
@@ -95,6 +93,7 @@ static struct g_raid_tr_class g_raid_tr_
 	"RAID5",
 	g_raid_tr_raid5_methods,
 	sizeof(struct g_raid_tr_raid5_object),
+	.trc_enable = 1,
 	.trc_priority = 100
 };
 
@@ -419,4 +418,4 @@ g_raid_tr_free_raid5(struct g_raid_tr_ob
 	return (0);
 }
 
-G_RAID_TR_DECLARE(g_raid_tr_raid5);
+G_RAID_TR_DECLARE(raid5, "RAID5");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209160842.q8G8gelW043344>