From nobody Thu Jun 06 10:37:43 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw14S1bgGz5Mdsm; Thu, 06 Jun 2024 10:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw14S0zjCz4hql; Thu, 6 Jun 2024 10:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717670264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Xc4C/opHxg79qNWfrDX+g7/813eTp3CbvNJd1FGjOw=; b=ubikpE4h+Z9peHCc43UvdTIy9h1PbTeXMFG58sIBUjFZrHuEQhPZUOlvWj0SBzdB6uXD+t togLAANlql8Sps/sRSDdsWnT7u9FnsAkEfcWp0SND2E4+McnzmtuU35HdNkUp5qtimj883 2RBo/k9YDwzOdarPHQR7cu85o9g4ZhFNO9T5sGIxKcf6dLkd7sdrF8Fkq7oEkNJnnMvwb4 SAXLWnMc/6Kf+zHMx3pgr6cBFYn32E+P3sWq2MwhRk9Vs9Me1odgEihog6fb3hXBGdS1Xl hMddML1cb88B0n3a9VX9xOJH++DTX2M4Bq7tTLgpNAB8uJr5X+hiUU8B0/hbCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670264; a=rsa-sha256; cv=none; b=QrmDITSXah1B9DHK8ToBSClHI4+v94jgZnYaaVeAX/DZVulbzmc3Bu04tt3jD0jy+obDTY +4tQAdLKnJgIiL3JpQpTLOpPTyIwG4y91p0ZFHRnBe8oT2fMrKn1puDrAwOfKm+zecnolK 55Qb2dyGn8V6xMczXyY1L6pjRqpzY13lBSLXKIGUHoV0ohfuSiS4NOki6aKeYIa6FyaXZP z+Fe/PKTBtoaI6mKqc/pu8GaT4Hg2U8yX1p22xv2EpRjfhNHp3PZ5H18dWy8iLsUtAZFuB kBMLAWdEMbQkdqZr0ZTOApFTJvI4vSrdrxgvBhKYYfaRNX1zZHuQ9y+lfiYbXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717670264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Xc4C/opHxg79qNWfrDX+g7/813eTp3CbvNJd1FGjOw=; b=WButSmaHPFW8levoSY7ppkOLzSDUXtBerUNgA6tLXFiK965BCRm8vwYiaPflGrej1TMVOV nwzE+0t+j2oreMw1Nn8KgGqI/rnJSZOIEtRhh+2WPLo3lO3Pma4ZHB6+MbYNxD3KutUlDo 6qw0invssrPj6eDs3QrMvWSfjhEF+MJDz/HNoZoIMF8OS/fHTlNNpdylPu90je9BkIhB45 fvg1ldjaOt8UQuGlZ6LIwo3AnRN0V2CvfoTf67oXCRLPNYSzNYRPKuNCoNNUukBBJtzBDc Tzr+zIiC58fRwM/IPzQw4jx3TqL0BABMI5ucinAE7oVPan0HpmVjyTPyHoMRSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw14S0SdtzjLh; Thu, 6 Jun 2024 10:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AbhFF089121; Thu, 6 Jun 2024 10:37:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Abhkv089118; Thu, 6 Jun 2024 10:37:43 GMT (envelope-from git) Date: Thu, 6 Jun 2024 10:37:43 GMT Message-Id: <202406061037.456Abhkv089118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan =?utf-8?Q?E=C3=9Fer?= Subject: git: 17e85f59907a - main - newfs_msdos: align to multiple of cluster size by default List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17e85f59907aecc0c9e812ee094303f6e1fdd845 Auto-Submitted: auto-generated The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=17e85f59907aecc0c9e812ee094303f6e1fdd845 commit 17e85f59907aecc0c9e812ee094303f6e1fdd845 Author: Stefan Eßer AuthorDate: 2024-06-06 10:28:02 +0000 Commit: Stefan Eßer CommitDate: 2024-06-06 10:28:02 +0000 newfs_msdos: align to multiple of cluster size by default A previous commit aligned the start of the data area to a multiple of the VM page size, in order to prevent extra buffers to be allocated (which failed for 64 KB cluster size without this alignment). Since a dependency on PAGE_SIZE caused compatibility issues, the alignment was made conditional on this macro being defined, in the previous commit. This lead to different behavior of this program when built on FreeBSD vs. Linux (which does not define PAGE_SIZE). This commit removes any use of PAGE_SIZE and instead always aligns the start of the data area to a multiple of the cluster size. The -A option is now implied, unless overridden by a specific number of reserved sectors with the -r option. Approved by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45436 --- sbin/newfs_msdos/mkfs_msdos.c | 9 +-------- sbin/newfs_msdos/newfs_msdos.8 | 20 ++++++++------------ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c index 1bca560a59e1..dcc2bb982efc 100644 --- a/sbin/newfs_msdos/mkfs_msdos.c +++ b/sbin/newfs_msdos/mkfs_msdos.c @@ -568,14 +568,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op) x1 += (bpb.bpbBigFATsecs - 1) * bpb.bpbFATs; } if (set_res) { - if (o.align) - alignto = bpb.bpbSecPerClust; - else -#ifdef PAGE_SIZE - alignto = PAGE_SIZE / bpb.bpbBytesPerSec; -#else - alignto = 1; -#endif + alignto = bpb.bpbSecPerClust; if (alignto > 1) { /* align data clusters */ alignment = (bpb.bpbResSectors + bpb.bpbBigFATsecs * bpb.bpbFATs + rds) % diff --git a/sbin/newfs_msdos/newfs_msdos.8 b/sbin/newfs_msdos/newfs_msdos.8 index 816b5fc867b4..92e407ab81af 100644 --- a/sbin/newfs_msdos/newfs_msdos.8 +++ b/sbin/newfs_msdos/newfs_msdos.8 @@ -23,7 +23,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd June 2, 2024 +.Dd June 6, 2024 .Dt NEWFS_MSDOS 8 .Os .Sh NAME @@ -91,13 +91,11 @@ A suffix s, k, m, g (lower or upper case) appended to the offset specifies that the number is in sectors, kilobytes, megabytes or gigabytes, respectively. .It Fl A -Attempt to cluster align the data area, useful for SD card. -If neither the -.Fl A -nor +Attempt to cluster align the data area, useful for flash based storage. +This option is enabled by default, unless a number of reserved sectors +is specified using the .Fl r -option is used, the number of reserved sectors is set to a value that aligns -the start of the data area to a multiple of the page size of the host. +option. .It Fl B Ar boot Get bootstrap from file. .It Fl C Ar create-size @@ -173,12 +171,10 @@ is 2. Number of hidden sectors. .It Fl r Ar reserved Number of reserved sectors. -If neither the -.Fl A -nor +If the .Fl r -option is used, the number of reserved sectors is set to a value that aligns -the start of the data area to a multiple of the page size of the host. +option is not used, the number of reserved sectors is set to a value that +aligns the start of the data area to a multiple of the cluster size. .It Fl s Ar total File system size. .It Fl u Ar track-size