summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2013-12-13 20:33:59 +0000
committertrasz <trasz@FreeBSD.org>2013-12-13 20:33:59 +0000
commita82d470c95dfbb07e973745cfbe6dc42ed1ab8b1 (patch)
tree2137e6071c1e18e16f171dfb1f9ec1330183f437 /sys/geom
parent39d7d288c5616ac0a19ddaa330c8c56752a6d7e2 (diff)
downloadFreeBSD-src-a82d470c95dfbb07e973745cfbe6dc42ed1ab8b1.zip
FreeBSD-src-a82d470c95dfbb07e973745cfbe6dc42ed1ab8b1.tar.gz
MFC r256724:
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. MFC r256766: Fix build with gcc by spelling unused format string as "unused" instead of NULL. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_slice.c2
-rw-r--r--sys/geom/label/g_label.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index 0f12a0a..976d840 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -382,7 +382,7 @@ g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length
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();
diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c
index 2011b77..fc16f7f 100644
--- a/sys/geom/label/g_label.c
+++ b/sys/geom/label/g_label.c
@@ -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, "notused");
+}
+
static int
g_label_is_name_ok(const char *label)
{
@@ -208,6 +219,7 @@ g_label_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
}
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);
OpenPOWER on IntegriCloud