Date: Tue, 12 Aug 2014 09:10:14 +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: r269852 - in head: sbin/geom/class/part sys/geom/part Message-ID: <53e9d9f6.6050.76e4ac5b@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Tue Aug 12 09:10:13 2014 New Revision: 269852 URL: http://svnweb.freebsd.org/changeset/base/269852 Log: Add sysctl and loader tunable kern.geom.part.mbr.enforce_chs that is set by default. It can be used to disable automatic alignment to CHS geometry, that GEOM_PART_MBR does. Reviewed by: wblock MFC after: 1 week Modified: head/sbin/geom/class/part/gpart.8 head/sys/geom/part/g_part_mbr.c Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Tue Aug 12 02:09:00 2014 (r269851) +++ head/sbin/geom/class/part/gpart.8 Tue Aug 12 09:10:13 2014 (r269852) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2014 +.Dd August 12, 2014 .Dt GPART 8 .Os .Sh NAME @@ -1183,6 +1183,12 @@ If this variable set to 1 each component present as independent partition. .Em NOTE : This may break a mirrored volume and lead to data damage. +.It Va kern.geom.part.mbr.enforce_chs : No 1 +Specify how the Master Boot Record (MBR) module does alignment. +If this variable is set to a non-zero value, the module will automatically +recalculate the user-specified offset and size for alignment with the CHS +geometry. +Otherwise the values will be left unchanged. .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Tue Aug 12 02:09:00 2014 (r269851) +++ head/sys/geom/part/g_part_mbr.c Tue Aug 12 09:10:13 2014 (r269852) @@ -49,6 +49,14 @@ __FBSDID("$FreeBSD$"); FEATURE(geom_part_mbr, "GEOM partitioning class for MBR support"); +SYSCTL_DECL(_kern_geom_part); +static SYSCTL_NODE(_kern_geom_part, OID_AUTO, mbr, CTLFLAG_RW, 0, + "GEOM_PART_MBR Master Boot Record"); + +static u_int enforce_chs = 1; +SYSCTL_UINT(_kern_geom_part_mbr, OID_AUTO, enforce_chs, + CTLFLAG_RWTUN, &enforce_chs, 1, "Enforce alignment to CHS addressing"); + #define MBRSIZE 512 struct g_part_mbr_table { @@ -200,6 +208,8 @@ mbr_align(struct g_part_table *basetable { uint32_t sectors; + if (enforce_chs == 0) + return (0); sectors = basetable->gpt_sectors; if (*size < sectors) return (EINVAL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e9d9f6.6050.76e4ac5b>