git: b241767f8ef3 - main - Eliminate unnecessary UFS1 integrity checks.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Tue, 20 Feb 2024 00:17:38 UTC
The branch main has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=b241767f8ef38f9ca7c109fe2fccd11ccbfaa4f0

commit b241767f8ef38f9ca7c109fe2fccd11ccbfaa4f0
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2024-02-20 00:16:07 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2024-02-20 00:17:05 +0000

    Eliminate unnecessary UFS1 integrity checks.
    
    The UFS1 integrity checks added in FreeBSD 14 were too aggressive
    for UFS1 filesystems created in FreeBSD 4 and 9 systems. This patch
    removes those tests which can be done safely since they are not
    relevant to the current implementation of UFS1.
    
    This is a follow-on report to bug report 264450 (comments 21-28).
    
    Reported by: slb@sonnet.com
    Tested by:   slb@sonnet.com
    PR:          264450
    MFC after:   1 week
---
 sbin/fsck_ffs/fsutil.c | 2 --
 sys/ufs/ffs/ffs_subr.c | 4 ----
 2 files changed, 6 deletions(-)

diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index aa536fb5dd4e..2acf825b159f 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -1017,7 +1017,6 @@ check_cgmagic(int cg, struct bufarea *cgbp)
 	CHK(cgp->cg_ndblk, >, sblock.fs_fpg, "%jd");
 	if (sblock.fs_magic == FS_UFS1_MAGIC) {
 		CHK(cgp->cg_old_niblk, !=, sblock.fs_ipg, "%jd");
-		CHK(cgp->cg_old_ncyl, >, sblock.fs_old_cpg, "%jd");
 	} else if (sblock.fs_magic == FS_UFS2_MAGIC) {
 		CHK(cgp->cg_niblk, !=, sblock.fs_ipg, "%jd");
 		CHK(cgp->cg_initediblk, >, sblock.fs_ipg, "%jd");
@@ -1034,7 +1033,6 @@ check_cgmagic(int cg, struct bufarea *cgbp)
 	} else if (sblock.fs_magic == FS_UFS1_MAGIC) {
 		CHK(cgp->cg_niblk, !=, 0, "%jd");
 		CHK(cgp->cg_initediblk, !=, 0, "%jd");
-		CHK(cgp->cg_old_ncyl, !=, sblock.fs_old_cpg, "%jd");
 		CHK(cgp->cg_old_niblk, !=, sblock.fs_ipg, "%jd");
 		CHK(cgp->cg_old_btotoff, !=, start, "%jd");
 		CHK(cgp->cg_old_boff, !=, cgp->cg_old_btotoff +
diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
index 20addf66a65b..bcb4d25c8ad9 100644
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -395,7 +395,6 @@ validate_sblock(struct fs *fs, int flags)
 		} else if (fs->fs_magic == FS_UFS1_MAGIC) {
 			FCHK(fs->fs_sblockloc, <, 0, %jd);
 			FCHK(fs->fs_sblockloc, >, SBLOCK_UFS1, %jd);
-			FCHK(fs->fs_old_ncyl, !=, fs->fs_ncg, %jd);
 		}
 		FCHK(fs->fs_frag, <, 1, %jd);
 		FCHK(fs->fs_frag, >, MAXFRAG, %jd);
@@ -472,16 +471,13 @@ validate_sblock(struct fs *fs, int flags)
 		WCHK(fs->fs_old_rotdelay, !=, 0, %jd);
 		WCHK(fs->fs_old_rps, !=, 60, %jd);
 		WCHK(fs->fs_old_nspf, !=, fs->fs_fsize / sectorsize, %jd);
-		FCHK(fs->fs_old_cpg, !=, 1, %jd);
 		WCHK(fs->fs_old_interleave, !=, 1, %jd);
 		WCHK(fs->fs_old_trackskew, !=, 0, %jd);
 		WCHK(fs->fs_old_cpc, !=, 0, %jd);
 		WCHK(fs->fs_old_postblformat, !=, 1, %jd);
 		FCHK(fs->fs_old_nrpos, !=, 1, %jd);
-		WCHK(fs->fs_old_spc, !=, fs->fs_fpg * fs->fs_old_nspf, %jd);
 		WCHK(fs->fs_old_nsect, !=, fs->fs_old_spc, %jd);
 		WCHK(fs->fs_old_npsect, !=, fs->fs_old_spc, %jd);
-		FCHK(fs->fs_old_ncyl, !=, fs->fs_ncg, %jd);
 	} else {
 		/* Bad magic number, so assume not a superblock */
 		return (ENOENT);