From nobody Wed May 15 05:40:14 2024 X-Original-To: dev-commits-src-main@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 4VfMWL70Pjz5KDJT; Wed, 15 May 2024 05:40:14 +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 4VfMWL6SB0z4HPY; Wed, 15 May 2024 05:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715751614; 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=nQ87ZNDm9hEV6nPgnY4aqhTvUArURUzdeb5MXuWZQkA=; b=m+i0VauzhEAmLPlWMSz3NwrWqoGiexoZSjDRh4NY/oXeoDFj2HSBjy6FNLH55HPqSoDdz7 lWKFNU7jkbXtatHTS7W/Xgoe/4+EpoteIHUZCCuItk7f1zYAZgL92GR2wVhA41Rvs3aNWp 2w8bdyXIywTgdbkWB9h6wVx2u5vRllcUwYshiRC88g0E8cCJ/hw5M76wy5pbo51P04xdiY V7LTh1W05tzvlyWzFjOdlfe6SgLKpzo8MbijPtWEPUhH3xcwEvcHRSdEg2LaNBWmmid6fF emRKYqopMMnMn1f1HxvHBESi67eNKOLCnZxGQIhjBfQ9tW586nmyiEUwJsKchw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715751614; a=rsa-sha256; cv=none; b=fxp+UbTajLpc/+KVsn8yupkCxJGK+PTxb90qCp+sQtQzC509Hdeh4pIdFdoaDsy6Q2b8PD QcgMxSCrW8IolOwEf8LZnesvRFN2C1pt5gFlkhn1hPituPACS8vQC58B56ygQLMAIJOFno WCoqdb2GGHX6xww11D0fMTkk8RMFGYhMQcsw5v/jUCguJuh097D0EdmScaXn9VKDmQK2xl Kwnwxej0e9mdSOQQ3SZepE2c5gcqmVbZJx4SKeoyK9qbfXbBIxDAYEW1P1XbU5b6qVMrWE jjtOWrDFno2iw3I9vlmcCcffw3kkLKfJuTz31CpGzoBlSV9RJj4l/hlXrt79Bg== 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=1715751614; 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=nQ87ZNDm9hEV6nPgnY4aqhTvUArURUzdeb5MXuWZQkA=; b=IpSX5FJRPdZRAxfjTpZNq5YgjkrCvbTq5GaNC2XEgOLOBkpu2gRXetpSNb2xSrwrlz1TLs mH8oihjVJcg1BhTVUTY1O5uQtPiUhM1kr4P8tv42ZcEm6HIub5KffNmYaTrPDFMVyfrXiX kOe9dIJoDitJ4w5EiBEX5hx9zu8/sQ4llWYtNRi/w8kE8oLFdxO9qbXEbfA+TMOGH7X42f u7iFU3OgZv+T4W6TwERLW8CHHdCRrvUuzjRpzicQ/syL5FThWmGN4g13JzkSTbv0ESkurM W3XqLRSTFFfjZtUSGir7BFdA46U42UMAv0d0eRPblKZW3xDXCB0F9o1i37yhyg== 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 4VfMWL5xrsz1351; Wed, 15 May 2024 05:40:14 +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 44F5eEf3013451; Wed, 15 May 2024 05:40:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44F5eEtA013445; Wed, 15 May 2024 05:40:14 GMT (envelope-from git) Date: Wed, 15 May 2024 05:40:14 GMT Message-Id: <202405150540.44F5eEtA013445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 61dece6d27fb - main - Enable soft updates by default for UFS2 filesystems. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61dece6d27fb2436928ca93d65667b358e05aa7b Auto-Submitted: auto-generated The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=61dece6d27fb2436928ca93d65667b358e05aa7b commit 61dece6d27fb2436928ca93d65667b358e05aa7b Author: Kirk McKusick AuthorDate: 2024-05-15 05:38:35 +0000 Commit: Kirk McKusick CommitDate: 2024-05-15 05:40:01 +0000 Enable soft updates by default for UFS2 filesystems. Soft updates dramatically improve the performance of UFS filesystems. The newfs(8) utility currently does not enable them by default. The FreeBSD installer enables soft updates by default. However custom built installations that do not specify the -U option to newfs(8) and the prebuilt UFS system images get filesystems without soft updates enabled. There are several testing sites that run benchmarks comparing the performance of Linux distributions versus BSD distributions. When they run filesystem comparison benchmarks they use newfs(8) to create the UFS filesystem. Because it does not have soft updates enabled it runs poorly versus the Linux ext4 filesystem. When I have suggested to them that they should enable soft updates on the UFS filesystem in their testing their response is that they expect the utility that creates the filesystem to use optimal defaults and that they cannot be expected to fiddle with various option settings. The purpose of this change is to give a filesystem created with newfs(8) reasonably optimal settings. For UFS2 this means enabling soft updates. For UFS1 which tends to be used on small systems with minimal memory and CPU speed, the lower memory footprint of running without soft updates is a more sensible default. This change adds a note in the section of the newfs(8) manual page that describes the -U option for enabling soft updates that they are enabled by default for UFS2 filesystems and that they can be disabled by using tunefs(8). Reviewed-by: Warner Losh, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45201 --- sbin/newfs/newfs.8 | 6 +++++- sbin/newfs/newfs.c | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index 05d2413a44e4..a7f792635aa9 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 21, 2022 +.Dd May 18, 2024 .Dt NEWFS 8 .Os .Sh NAME @@ -98,6 +98,10 @@ The default format is UFS2. For backward compatibility. .It Fl U Enable soft updates on the new file system. +Soft updates are enabled by default for UFS2 format file systems. +Use +.Xr tunefs 8 +to disable soft updates if they are not wanted. .It Fl a Ar maxcontig Specify the maximum number of contiguous blocks that will be laid out before forcing a rotational delay. diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 38781368e8ca..49bd8b7dc4b6 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -383,6 +383,9 @@ main(int argc, char *argv[]) fprintf(stderr, "because minfree is less than %d%%\n", MINFREE); opt = FS_OPTSPACE; } + /* Use soft updates by default for UFS2 and above */ + if (Oflag > 1) + Uflag = 1; realsectorsize = sectorsize; if (sectorsize != DEV_BSIZE) { /* XXX */ int secperblk = sectorsize / DEV_BSIZE;