From owner-svn-src-head@FreeBSD.ORG Tue Jan 6 14:10:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D88C1065672; Tue, 6 Jan 2009 14:10:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B2EF8FC0C; Tue, 6 Jan 2009 14:10:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n06EABtp033160; Tue, 6 Jan 2009 14:10:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n06EABW2033159; Tue, 6 Jan 2009 14:10:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200901061410.n06EABW2033159@svn.freebsd.org> From: Marius Strobl Date: Tue, 6 Jan 2009 14:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186823 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2009 14:10:12 -0000 Author: marius Date: Tue Jan 6 14:10:10 2009 New Revision: 186823 URL: http://svn.freebsd.org/changeset/base/186823 Log: - Don't enforce an upper-bound to the number of sectors or heads, allowing the full 16-bit width of the corresponding fields in the VTOC8 label to be used. The removed limits basically only held true for providers labeled using the synthetic geometry provided by cam_calc_geometry(9) but neither SCSI disks labeled with Solaris nor sufficiently large ATA disks. - Given that providers (originally) labeled with Solaris typically use the native geometry as reported by the target while FreeBSD typically uses a synthetic one put the message complaining about mismatching geometries between what the label indicates and what GEOM thinks the provider has, which we generally can't help, under bootverbose in order to not unnecessarily scare users. - For informational purposes add the non-matching values to the message complaining about them, similar to what r186501 did for g_part_bsd_read() except also indicating the origin of the values. - Make it clear that the messages emitted by this code refer to the VTOC8 support rather than to another existing scheme or to VTOC32. Modified: head/sys/geom/part/g_part_vtoc8.c Modified: head/sys/geom/part/g_part_vtoc8.c ============================================================================== --- head/sys/geom/part/g_part_vtoc8.c Tue Jan 6 13:59:59 2009 (r186822) +++ head/sys/geom/part/g_part_vtoc8.c Tue Jan 6 14:10:10 2009 (r186823) @@ -371,7 +371,7 @@ g_part_vtoc8_read(struct g_part_table *b msize = pp->mediasize / pp->sectorsize; sectors = be16dec(&table->vtoc.nsecs); - if (sectors < 1 || sectors > 63) + if (sectors < 1) goto invalid_label; if (sectors != basetable->gpt_sectors && !basetable->gpt_fixgeom) { g_part_geometry_heads(msize, sectors, &chs, &heads); @@ -382,13 +382,21 @@ g_part_vtoc8_read(struct g_part_table *b } heads = be16dec(&table->vtoc.nheads); - if (heads < 1 || heads > 255) + if (heads < 1) goto invalid_label; if (heads != basetable->gpt_heads && !basetable->gpt_fixgeom) basetable->gpt_heads = heads; - if (sectors != basetable->gpt_sectors || - heads != basetable->gpt_heads) - printf("GEOM: %s: geometry does not match label.\n", pp->name); + /* + * Except for ATA disks > 32GB, Solaris uses the native geometry + * as reported by the target for the labels while da(4) typically + * uses a synthetic one so we don't complain too loudly if these + * geometries don't match. + */ + if (bootverbose && (sectors != basetable->gpt_sectors || + heads != basetable->gpt_heads)) + printf("GEOM: %s: geometry does not match VTOC8 label " + "(label: %uh,%us GEOM: %uh,%us).\n", pp->name, heads, + sectors, basetable->gpt_heads, basetable->gpt_sectors); table->secpercyl = heads * sectors; cyls = be16dec(&table->vtoc.ncyls); @@ -402,7 +410,7 @@ g_part_vtoc8_read(struct g_part_table *b withtags = (be32dec(&table->vtoc.sanity) == VTOC_SANITY) ? 1 : 0; if (!withtags) { - printf("GEOM: %s: adding VTOC information.\n", pp->name); + printf("GEOM: %s: adding VTOC8 information.\n", pp->name); be32enc(&table->vtoc.version, VTOC_VERSION); bzero(&table->vtoc.volume, VTOC_VOLUME_LEN); be16enc(&table->vtoc.nparts, VTOC8_NPARTS); @@ -444,7 +452,7 @@ g_part_vtoc8_read(struct g_part_table *b return (0); invalid_label: - printf("GEOM: %s: invalid disklabel.\n", pp->name); + printf("GEOM: %s: invalid VTOC8 label.\n", pp->name); return (EINVAL); }