From owner-dev-commits-src-main@freebsd.org Mon Jul 5 15:17:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97C1C65E830; Mon, 5 Jul 2021 15:17:54 +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 4GJTpB3DQ3z4Vdh; Mon, 5 Jul 2021 15:17:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 50B0B160; Mon, 5 Jul 2021 15:17:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 165FHsNu012513; Mon, 5 Jul 2021 15:17:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 165FHsfD012512; Mon, 5 Jul 2021 15:17:54 GMT (envelope-from git) Date: Mon, 5 Jul 2021 15:17:54 GMT Message-Id: <202107051517.165FHsfD012512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af433832f7520840c22edd1fe1266c1a5cb781ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 15:17:54 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=af433832f7520840c22edd1fe1266c1a5cb781ad commit af433832f7520840c22edd1fe1266c1a5cb781ad Author: Jessica Clarke AuthorDate: 2021-07-05 15:15:32 +0000 Commit: Jessica Clarke CommitDate: 2021-07-05 15:15:32 +0000 geom_label: Remove an old sysinstall(8) workaround We removed sysinstall(8) back in 2011, so this workaround should be long since unnecessary. This workaround can end up breaking cases that are hit in the real world, such as dd'ing a small pre-built disk image to a large partition that you intend to grow on first boot and uses a UFS disk label for / in its /etc/fstab (as the only reliable thing a raw UFS image can reference). Reviewed by: imp, mckusick Differential Revision: https://reviews.freebsd.org/D30825 --- sys/geom/label/g_label_ufs.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/sys/geom/label/g_label_ufs.c b/sys/geom/label/g_label_ufs.c index ababbaa4b43a..70d59488d7b6 100644 --- a/sys/geom/label/g_label_ufs.c +++ b/sys/geom/label/g_label_ufs.c @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); #define G_LABEL_UFS_ID 1 /* - * G_LABEL_UFS_CMP returns true if difference between provider mediasize - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors - */ -#define G_LABEL_UFS_CMP(prov, fsys, size) \ - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize )) \ - < G_LABEL_UFS_MAXDIFF ) -#define G_LABEL_UFS_MAXDIFF 0x100 - -/* - * Try to find a superblock on the provider. If successful, then - * check that the size in the superblock corresponds to the size - * of the underlying provider. Finally, look for a volume label - * and create an appropriate provider based on that. + * Try to find a superblock on the provider. If successful, look for a volume + * label and create an appropriate provider based on that. */ static void g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, int what) @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t size, int wh return; } - /* - * Check for magic. We also need to check if file system size - * is almost equal to providers size, because sysinstall(8) - * used to bogusly put first partition at offset 0 - * instead of 16, and glabel/ufs would find file system on slice - * instead of partition. - * - * In addition, media size can be a bit bigger than file system - * size. For instance, mkuzip can append bytes to align data - * to large sector size (it improves compression rates). - */ - if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { + /* Check for magic. */ + if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0) { /* Valid UFS1. */ - } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && - ( G_LABEL_UFS_CMP(pp, fs, fs_size) - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { + } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0) { /* Valid UFS2. */ } else { goto out;