From owner-svn-src-all@freebsd.org Mon Feb 27 17:54:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD836CEFBC9; Mon, 27 Feb 2017 17:54:02 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 61BD93DD; Mon, 27 Feb 2017 17:54:02 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1RHs1pN096910; Mon, 27 Feb 2017 17:54:01 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1RHs1LI096908; Mon, 27 Feb 2017 17:54:01 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201702271754.v1RHs1LI096908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 27 Feb 2017 17:54:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314359 - in head: sbin/geom/class/part 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2017 17:54:02 -0000 Author: oshogbo Date: Mon Feb 27 17:54:01 2017 New Revision: 314359 URL: https://svnweb.freebsd.org/changeset/base/314359 Log: Add sysctl to control auto resize of the GEOM metadata. Reviewed by: AllanJude Differential Revision: https://reviews.freebsd.org/D9603 Modified: head/sbin/geom/class/part/gpart.8 head/sys/geom/part/g_part.c Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Mon Feb 27 17:50:38 2017 (r314358) +++ head/sbin/geom/class/part/gpart.8 Mon Feb 27 17:54:01 2017 (r314359) @@ -1146,6 +1146,18 @@ variables can be used to control the beh GEOM class. The default value is shown next to each variable. .Bl -tag -width indent +.It Va kern.geom.part.auto_resize: No 1 +This variable controls automatic resize behavior of +.Nm +GEOM class. +When this variable is enable and new size of provider is detected, the schema +metadata is resized but all changes are not saved to disk, until +.Cm gpart commit +is run to confirm changes. +This behavior is also reported with diagnostic message: +.Sy "GEOM_PART: (provider) was automatically resized." +.Sy "Use `gpart commit (provider)` to save changes or `gpart undo (provider)`" +.Sy "to revert them." .It Va kern.geom.part.check_integrity : No 1 This variable controls the behaviour of metadata integrity checks. When integrity checks are enabled, the Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Mon Feb 27 17:50:38 2017 (r314358) +++ head/sys/geom/part/g_part.c Mon Feb 27 17:54:01 2017 (r314359) @@ -135,6 +135,10 @@ static u_int check_integrity = 1; SYSCTL_UINT(_kern_geom_part, OID_AUTO, check_integrity, CTLFLAG_RWTUN, &check_integrity, 1, "Enable integrity checking"); +static u_int auto_resize = 1; +SYSCTL_UINT(_kern_geom_part, OID_AUTO, auto_resize, + CTLFLAG_RW, &auto_resize, 1, + "Enable auto resize"); /* * The GEOM partitioning class. @@ -2095,6 +2099,9 @@ g_part_resize(struct g_consumer *cp) G_PART_TRACE((G_T_TOPOLOGY, "%s(%s)", __func__, cp->provider->name)); g_topology_assert(); + if (auto_resize == 0) + return; + table = cp->geom->softc; if (table->gpt_opened == 0) { if (g_access(cp, 1, 1, 1) != 0)