Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jan 2010 13:14:37 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r201645 - in head/sys/geom: . part uzip
Message-ID:  <201001061314.o06DEb8t033566@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Jan  6 13:14:37 2010
New Revision: 201645
URL: http://svn.freebsd.org/changeset/base/201645

Log:
  Change the way in which zero stripesize is handled. Instead of reporting
  zero stripeoffset in such case (as if device has no stripes), report offset
  from the beginning of the media (as if device has single infinite stripe).
  
  This gives partitioning tools information, required to guess better
  partition alignment, in case if hardware doesn't report it's stripe size.
  For example, it should give disklabel info about odd offset made by fdisk.

Modified:
  head/sys/geom/geom_slice.c
  head/sys/geom/part/g_part.c
  head/sys/geom/uzip/g_uzip.c

Modified: head/sys/geom/geom_slice.c
==============================================================================
--- head/sys/geom/geom_slice.c	Wed Jan  6 13:13:14 2010	(r201644)
+++ head/sys/geom/geom_slice.c	Wed Jan  6 13:14:37 2010	(r201645)
@@ -393,10 +393,10 @@ g_slice_config(struct g_geom *gp, u_int 
 	pp = g_new_providerf(gp, sbuf_data(sb));
 	pp2 = LIST_FIRST(&gp->consumer)->provider;
 	pp->flags = pp2->flags & G_PF_CANDELETE;
-	if (pp2->stripesize > 0) {
-		pp->stripesize = pp2->stripesize;
-		pp->stripeoffset = (pp2->stripeoffset + offset) % pp->stripesize;
-	}
+	pp->stripesize = pp2->stripesize;
+	pp->stripeoffset = pp2->stripeoffset + offset;
+	if (pp->stripesize > 0)
+		pp->stripeoffset %= pp->stripesize;
 	if (0 && bootverbose)
 		printf("GEOM: Configure %s, start %jd length %jd end %jd\n",
 		    pp->name, (intmax_t)offset, (intmax_t)length,

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c	Wed Jan  6 13:13:14 2010	(r201644)
+++ head/sys/geom/part/g_part.c	Wed Jan  6 13:14:37 2010	(r201645)
@@ -288,11 +288,10 @@ g_part_new_provider(struct g_geom *gp, s
 	entry->gpe_pp->mediasize -= entry->gpe_offset - offset;
 	entry->gpe_pp->sectorsize = pp->sectorsize;
 	entry->gpe_pp->flags = pp->flags & G_PF_CANDELETE;
-	if (pp->stripesize > 0) {
-		entry->gpe_pp->stripesize = pp->stripesize;
-		entry->gpe_pp->stripeoffset = (pp->stripeoffset +
-		    entry->gpe_offset) % pp->stripesize;
-	}
+	entry->gpe_pp->stripesize = pp->stripesize;
+	entry->gpe_pp->stripeoffset = pp->stripeoffset + entry->gpe_offset;
+	if (pp->stripesize > 0)
+		entry->gpe_pp->stripeoffset %= pp->stripesize;
 	g_error_provider(entry->gpe_pp, 0);
 }
 

Modified: head/sys/geom/uzip/g_uzip.c
==============================================================================
--- head/sys/geom/uzip/g_uzip.c	Wed Jan  6 13:13:14 2010	(r201644)
+++ head/sys/geom/uzip/g_uzip.c	Wed Jan  6 13:14:37 2010	(r201645)
@@ -467,10 +467,8 @@ g_uzip_taste(struct g_class *mp, struct 
 	pp2->sectorsize = 512;
 	pp2->mediasize = (off_t)sc->nblocks * sc->blksz;
         pp2->flags = pp->flags & G_PF_CANDELETE;
-        if (pp->stripesize > 0) {
-                pp2->stripesize = pp->stripesize;
-                pp2->stripeoffset = pp->stripeoffset;
-        }
+        pp2->stripesize = pp->stripesize;
+        pp2->stripeoffset = pp->stripeoffset;
 	g_error_provider(pp2, 0);
 	g_access(cp, -1, 0, 0);
 



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