svn commit: r256724 - in head/sys/geom: . label

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Oct 18 09:14:20 UTC 2013


Author: trasz
Date: Fri Oct 18 09:14:19 2013
New Revision: 256724
URL: http://svnweb.freebsd.org/changeset/base/256724

Log:
  Make geom_label(4) resize-aware.  This fixes a situation when "gpart resize"
  would resize a partition, but label providers - e.g. /dev/gptid/XXX - would
  stay the same size.
  
  Reviewed by:	mav
  MFC after:	1 month
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/geom/geom_slice.c
  head/sys/geom/label/g_label.c

Modified: head/sys/geom/geom_slice.c
==============================================================================
--- head/sys/geom/geom_slice.c	Fri Oct 18 09:07:10 2013	(r256723)
+++ head/sys/geom/geom_slice.c	Fri Oct 18 09:14:19 2013	(r256724)
@@ -382,7 +382,7 @@ g_slice_config(struct g_geom *gp, u_int 
 			printf("GEOM: Reconfigure %s, start %jd length %jd end %jd\n",
 			    pp->name, (intmax_t)offset, (intmax_t)length,
 			    (intmax_t)(offset + length - 1));
-		pp->mediasize = gsl->length;
+		g_resize_provider(pp, gsl->length);
 		return (0);
 	}
 	sb = sbuf_new_auto();

Modified: head/sys/geom/label/g_label.c
==============================================================================
--- head/sys/geom/label/g_label.c	Fri Oct 18 09:07:10 2013	(r256723)
+++ head/sys/geom/label/g_label.c	Fri Oct 18 09:14:19 2013	(r256724)
@@ -124,6 +124,17 @@ g_label_spoiled(struct g_consumer *cp)
 	g_slice_spoiled(cp);
 }
 
+static void
+g_label_resize(struct g_consumer *cp)
+{
+
+	G_LABEL_DEBUG(1, "Label %s resized.",
+	    LIST_FIRST(&cp->geom->provider)->name);
+
+	g_slice_config(cp->geom, 0, G_SLICE_CONFIG_FORCE, (off_t)0,
+	    cp->provider->mediasize, cp->provider->sectorsize, NULL);
+}
+
 static int
 g_label_is_name_ok(const char *label)
 {
@@ -208,6 +219,7 @@ g_label_create(struct gctl_req *req, str
 	}
 	gp->orphan = g_label_orphan;
 	gp->spoiled = g_label_spoiled;
+	gp->resize = g_label_resize;
 	g_access(cp, -1, 0, 0);
 	g_slice_config(gp, 0, G_SLICE_CONFIG_SET, (off_t)0, mediasize,
 	    pp->sectorsize, "%s", name);


More information about the svn-src-head mailing list