Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 2009 14:10:11 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186823 - head/sys/geom/part
Message-ID:  <200901061410.n06EABW2033159@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



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