From owner-freebsd-geom@FreeBSD.ORG Sun Jul 16 14:03:16 2006 Return-Path: X-Original-To: freebsd-geom@freebsd.org Delivered-To: freebsd-geom@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4715A16A4DF for ; Sun, 16 Jul 2006 14:03:16 +0000 (UTC) (envelope-from lulf@stud.ntnu.no) Received: from merke.itea.ntnu.no (merke.itea.ntnu.no [129.241.7.61]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9BA7843D45 for ; Sun, 16 Jul 2006 14:03:10 +0000 (GMT) (envelope-from lulf@stud.ntnu.no) Received: from localhost (localhost [127.0.0.1]) by merke.itea.ntnu.no (Postfix) with ESMTP id AA99413CD63 for ; Sun, 16 Jul 2006 16:03:08 +0200 (CEST) Received: from gaupe.stud.ntnu.no (gaupe.stud.ntnu.no [129.241.56.184]) by merke.itea.ntnu.no (Postfix) with ESMTP for ; Sun, 16 Jul 2006 16:03:08 +0200 (CEST) Received: by gaupe.stud.ntnu.no (Postfix, from userid 2312) id 6A506CFFFB; Sun, 16 Jul 2006 16:03:08 +0200 (CEST) Date: Sun, 16 Jul 2006 16:03:08 +0200 From: Ulf Lilleengen To: freebsd-geom@freebsd.org Message-ID: <20060716140308.GA12802@stud.ntnu.no> References: <44B6CFAC.10702@swbell.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aVD9QWMuhilNxW9f" Content-Disposition: inline In-Reply-To: <44B6CFAC.10702@swbell.net> User-Agent: Mutt/1.5.9i X-Content-Scanned: with sophos and spamassassin at mailgw.ntnu.no. Subject: Re: Automatic subdisk naming? X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Jul 2006 14:03:16 -0000 --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--