Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jul 2006 16:03:08 +0200
From:      Ulf Lilleengen <lulf@stud.ntnu.no>
To:        freebsd-geom@freebsd.org
Subject:   Re: Automatic subdisk naming?
Message-ID:  <20060716140308.GA12802@stud.ntnu.no>
In-Reply-To: <44B6CFAC.10702@swbell.net>
References:  <44B6CFAC.10702@swbell.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--aVD9QWMuhilNxW9f
Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G"
Content-Disposition: inline


--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On tor, jul 13, 2006 at 05:56:44 -0500, Martin Jackson wrote:
> It's been a while, but I seem to recall that given a plex with org=20
> concat, the historic vinum could create subdisks that were automatically=
=20
> named with the name prefixes of the other objects in that volume.
>=20
> For example:
>=20
> drive vg device ad0s1g
>=20
> volume home
> 	plex org concat
> 	sd len 4g drive vg
>=20
> Which would create:
> home (volume)
> home.p0 (plex)
> home.p0.s0 (subdisk)
>=20
> Then, when the time came to expand the volume, the following could be use=
d:
>=20
> sd len 4g plex home.p0
>=20
> Which would create
> home.p0.s1
>=20
> and the volume home could be expanded with growfs.
>=20
> In the 6.1-RELEASE-p2 implementation of gvinum, when I try this, I get a=
=20
> subdisk simply named ".s0", but apparently added to the correct plex (it=
=20
> increases in size).
>=20
> Is this considered a bug?  Is it enough detail? :)  A casual search of=20
> PR's didn't show me anything that looked quite like this.
>=20

I looked into the gvinum_create code, and I think I found the reason for th=
is
bug. When a new subdisk is created, the instructions that name that subdisk=
 use
a sd_in_plex counter that is initially set to '0', and not initialized to t=
he
plex' subdisk counter. This is also the case when creating a plex.=20

The attached patch set's the name in gv_create in kernel instead, because o=
nly=20
there it has access to the sd/plex-counter that we need to set the correct =
name
of the subdisk and a plex. I need to test it better in sone edgecases befor=
e I
submit it. This patch is for RELENG_6 sources.

--=20
Mvh Ulf Lilleengen

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="plex_sd_naming.diff"
Content-Transfer-Encoding: quoted-printable

Index: sbin/gvinum/gvinum.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sbin/gvinum/gvinum.c,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 gvinum.c
--- sbin/gvinum/gvinum.c	26 Nov 2005 11:10:37 -0000	1.4.2.1
+++ sbin/gvinum/gvinum.c	16 Jul 2006 13:44:25 -0000
@@ -234,7 +234,7 @@
 			sd_in_plex =3D 0;
=20
 			/* Default name. */
-			if (strlen(p->name) =3D=3D 0) {
+			if (strlen(p->name) =3D=3D 0 && strlen(volume) > 0) {
 				snprintf(p->name, GV_MAXPLEXNAME, "%s.p%d",
 				    volume, plex_in_volume++);
 			}
@@ -268,7 +268,7 @@
 			}
=20
 			/* Default name. */
-			if (strlen(s->name) =3D=3D 0) {
+			if (strlen(s->name) =3D=3D 0 && strlen(plex) > 0) {
 				snprintf(s->name, GV_MAXSDNAME, "%s.s%d",
 				    plex, sd_in_plex++);
 			}
Index: sys/geom/vinum/geom_vinum.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/geom/vinum/geom_vinum.c,v
retrieving revision 1.16.2.3
diff -u -r1.16.2.3 geom_vinum.c
--- sys/geom/vinum/geom_vinum.c	10 Dec 2005 14:36:17 -0000	1.16.2.3
+++ sys/geom/vinum/geom_vinum.c	16 Jul 2006 13:45:00 -0000
@@ -245,6 +245,11 @@
 			LIST_INSERT_HEAD(&v->plexes, p, in_volume);
 		}
=20
+		/* Set plexname if not set. */
+		if (strlen(p->name) =3D=3D 0) {
+			snprintf(p->name, GV_PLEXNAME, "%s.p%d",
+			    p->volume, v->plexcount);
+		}
 		p->vinumconf =3D sc;
 		p->flags |=3D GV_PLEX_NEWBORN;
 		LIST_INIT(&p->subdisks);
@@ -287,6 +292,12 @@
 			continue;
 		}
=20
+		/* Set subdiskname if not set. */
+		if (strlen(s->name) =3D=3D 0) {
+			snprintf(s->name, GV_MAXSDNAME, "%s.s%d",
+			    s->plex, p->sdcount);
+		}
+
 		/*
 		 * First we give the subdisk to the drive, to handle autosized
 		 * values ...

--k1lZvvs/B4yU6o8G--

--aVD9QWMuhilNxW9f
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEukccCILg8nMIdCURAqM8AJ9N+JXFXAJAGRz/ALkGLAqjFRcQegCggSFU
YypxcfGG/vxzlkFAdSim11o=
=d3A0
-----END PGP SIGNATURE-----

--aVD9QWMuhilNxW9f--



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