From owner-svn-src-head@FreeBSD.ORG Wed May 7 11:18:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28303E9F; Wed, 7 May 2014 11:18:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFDF2AE5; Wed, 7 May 2014 11:18:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s47BISWr023514; Wed, 7 May 2014 11:18:28 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s47BIS6G023511; Wed, 7 May 2014 11:18:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201405071118.s47BIS6G023511@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 7 May 2014 11:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265539 - head/sys/geom/part X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 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: Wed, 07 May 2014 11:18:29 -0000 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);