svn commit: r280685 - head/sys/geom

Alexander Motin mav at FreeBSD.org
Thu Mar 26 11:02:30 UTC 2015


Author: mav
Date: Thu Mar 26 11:02:29 2015
New Revision: 280685
URL: https://svnweb.freebsd.org/changeset/base/280685

Log:
  When searching for provider by name, prefer non-withered one.
  
  MFC after:	2 weeks

Modified:
  head/sys/geom/geom_subr.c

Modified: head/sys/geom/geom_subr.c
==============================================================================
--- head/sys/geom/geom_subr.c	Thu Mar 26 10:44:16 2015	(r280684)
+++ head/sys/geom/geom_subr.c	Thu Mar 26 11:02:29 2015	(r280685)
@@ -683,21 +683,27 @@ g_provider_by_name(char const *arg)
 {
 	struct g_class *cp;
 	struct g_geom *gp;
-	struct g_provider *pp;
+	struct g_provider *pp, *wpp;
 
 	if (strncmp(arg, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
 		arg += sizeof(_PATH_DEV) - 1;
 
+	wpp = NULL;
 	LIST_FOREACH(cp, &g_classes, class) {
 		LIST_FOREACH(gp, &cp->geom, geom) {
 			LIST_FOREACH(pp, &gp->provider, provider) {
-				if (!strcmp(arg, pp->name))
+				if (strcmp(arg, pp->name) != 0)
+					continue;
+				if ((gp->flags & G_GEOM_WITHER) == 0 &&
+				    (pp->flags & G_PF_WITHER) == 0)
 					return (pp);
+				else
+					wpp = pp;
 			}
 		}
 	}
 
-	return (NULL);
+	return (wpp);
 }
 
 void


More information about the svn-src-head mailing list