Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2014 11:18:28 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265539 - head/sys/geom/part
Message-ID:  <201405071118.s47BIS6G023511@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed May  7 11:18:27 2014
New Revision: 265539
URL: http://svnweb.freebsd.org/changeset/base/265539

Log:
  It is safe to allow shrinking, when aligned size is bigger than current.
  
  Tested by:	jmg
  MFC after:	1 week

Modified:
  head/sys/geom/part/g_part_mbr.c
  head/sys/geom/part/g_part_pc98.c
  head/sys/geom/part/g_part_vtoc8.c

Modified: head/sys/geom/part/g_part_mbr.c
==============================================================================
--- head/sys/geom/part/g_part_mbr.c	Wed May  7 09:56:28 2014	(r265538)
+++ head/sys/geom/part/g_part_mbr.c	Wed May  7 11:18:27 2014	(r265539)
@@ -356,8 +356,8 @@ g_part_mbr_resize(struct g_part_table *b
 		return (EINVAL);
 	/* XXX: prevent unexpected shrinking. */
 	pp = baseentry->gpe_pp;
-	if ((g_debugflags & 16) == 0 && size < gpp->gpp_size &&
-	    (pp->acr > 0 || pp->acw > 0 || pp->ace > 0))
+	if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size &&
+	    pp->mediasize / pp->sectorsize > size)
 		return (EBUSY);
 	entry = (struct g_part_mbr_entry *)baseentry;
 	baseentry->gpe_end = baseentry->gpe_start + size - 1;

Modified: head/sys/geom/part/g_part_pc98.c
==============================================================================
--- head/sys/geom/part/g_part_pc98.c	Wed May  7 09:56:28 2014	(r265538)
+++ head/sys/geom/part/g_part_pc98.c	Wed May  7 11:18:27 2014	(r265539)
@@ -364,7 +364,7 @@ g_part_pc98_resize(struct g_part_table *
 	/* XXX: prevent unexpected shrinking. */
 	pp = baseentry->gpe_pp;
 	if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size &&
-	    (pp->acr > 0 || pp->acw > 0 || pp->ace > 0))
+	    pp->mediasize / pp->sectorsize > size)
 		return (EBUSY);
 	entry = (struct g_part_pc98_entry *)baseentry;
 	baseentry->gpe_end = baseentry->gpe_start + size - 1;

Modified: head/sys/geom/part/g_part_vtoc8.c
==============================================================================
--- head/sys/geom/part/g_part_vtoc8.c	Wed May  7 09:56:28 2014	(r265538)
+++ head/sys/geom/part/g_part_vtoc8.c	Wed May  7 11:18:27 2014	(r265539)
@@ -371,7 +371,7 @@ g_part_vtoc8_resize(struct g_part_table 
 	/* XXX: prevent unexpected shrinking. */
 	pp = entry->gpe_pp;
 	if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size &&
-	    (pp->acr > 0 || pp->acw > 0 || pp->ace > 0))
+	    pp->mediasize / pp->sectorsize > size)
 		return (EBUSY);
 	entry->gpe_end = entry->gpe_start + size - 1;
 	be32enc(&table->vtoc.map[entry->gpe_index - 1].nblks, size);



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