git: 239597e0309d - main - Text format cleanups. No functional changes intended.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Jul 2023 00:29:22 UTC
The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=239597e0309d4d8e84c35929513aa4a2470735ad commit 239597e0309d4d8e84c35929513aa4a2470735ad Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2023-07-18 00:28:07 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2023-07-18 00:29:09 +0000 Text format cleanups. No functional changes intended. MFC-after: 1 week Sponsored-by: The FreeBSD Foundation --- sbin/fsck_ffs/fsck.h | 6 +++--- sbin/fsck_ffs/gjournal.c | 15 ++++----------- sbin/fsck_ffs/globs.c | 24 ++++++++++++------------ sbin/fsck_ffs/main.c | 8 +++++--- sbin/fsck_ffs/pass1.c | 2 +- sbin/fsck_ffs/pass5.c | 34 ++++++++++++++++++++++------------ sbin/fsck_ffs/suj.c | 27 +++++++++++++++------------ 7 files changed, 62 insertions(+), 54 deletions(-) diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index 3b80169c1e3c..e48f3e0aa692 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -112,7 +112,7 @@ struct inostat { #define FSTATE 0x2 /* inode is file */ #define FZLINK 0x3 /* inode is file with a link count of zero */ #define DSTATE 0x4 /* inode is directory */ -#define DZLINK 0x5 /* inode is directory with a zero link count */ +#define DZLINK 0x5 /* inode is directory with a zero link count */ #define DFOUND 0x6 /* directory found during descent */ /* 0x7 UNUSED - see S_IS_DVALID() definition */ #define DCLEAR 0x8 /* directory is to be cleared */ @@ -297,8 +297,8 @@ struct dups { struct dups *next; ufs2_daddr_t dup; }; -extern struct dups *duplist; /* head of dup list */ -extern struct dups *muldup; /* end of unique duplicate dup block numbers */ +extern struct dups *duplist; /* head of dup list */ +extern struct dups *muldup; /* end of unique duplicate dup block numbers */ /* * Inode cache data structures. diff --git a/sbin/fsck_ffs/gjournal.c b/sbin/fsck_ffs/gjournal.c index f3bdd5a66907..03bf7f08b662 100644 --- a/sbin/fsck_ffs/gjournal.c +++ b/sbin/fsck_ffs/gjournal.c @@ -77,7 +77,6 @@ gjournal_check(const char *filesys) fs = &sblock; /* Are there any unreferenced inodes in this file system? */ if (fs->fs_unrefs == 0) { - //printf("No unreferenced inodes.\n"); sbdirty(); ckfini(1); return; @@ -105,7 +104,6 @@ gjournal_check(const char *filesys) /* Are there any unreferenced inodes in this cylinder group? */ if (cgp->cg_unrefs == 0) continue; - //printf("Analizing cylinder group %d (count=%d)\n", cg, cgp->cg_unrefs); /* * Now go through the list of all inodes in this cylinder group * to find unreferenced ones. @@ -150,20 +148,15 @@ gjournal_check(const char *filesys) inodirty(&ip); irelse(&ip); cgdirty(cgbp); - if (cgp->cg_unrefs == 0) { - //printf("No more unreferenced inodes in cg=%d.\n", cg); + if (cgp->cg_unrefs == 0) break; - } } /* - * If there are no more unreferenced inodes, there is no need to - * check other cylinder groups. + * If there are no more unreferenced inodes, there is no + * need to check other cylinder groups. */ - if (fs->fs_unrefs == 0) { - //printf("No more unreferenced inodes (cg=%d/%d).\n", cg, - // fs->fs_ncg); + if (fs->fs_unrefs == 0) break; - } } /* Write back updated statistics and super-block. */ sbdirty(); diff --git a/sbin/fsck_ffs/globs.c b/sbin/fsck_ffs/globs.c index 7aef7364eeba..22b15186ecaa 100644 --- a/sbin/fsck_ffs/globs.c +++ b/sbin/fsck_ffs/globs.c @@ -60,18 +60,18 @@ ino_t cursnapshot; long dirhash, inplast; unsigned long numdirs, listmax; long countdirs; /* number of directories we actually found */ -int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */ -int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */ -int setsize[MIBSIZE]; /* MIB command to set inode size */ -int adjndir[MIBSIZE]; /* MIB command to adjust number of directories */ -int adjnbfree[MIBSIZE]; /* MIB command to adjust number of free blocks */ -int adjnifree[MIBSIZE]; /* MIB command to adjust number of free inodes */ -int adjnffree[MIBSIZE]; /* MIB command to adjust number of free frags */ -int adjnumclusters[MIBSIZE]; /* MIB command to adjust number of free clusters */ +int adjrefcnt[MIBSIZE]; /* MIB cmd to adjust inode reference cnt */ +int adjblkcnt[MIBSIZE]; /* MIB cmd to adjust inode block count */ +int setsize[MIBSIZE]; /* MIB cmd to set inode size */ +int adjndir[MIBSIZE]; /* MIB cmd to adjust number of directories */ +int adjnbfree[MIBSIZE]; /* MIB cmd to adjust number of free blocks */ +int adjnifree[MIBSIZE]; /* MIB cmd to adjust number of free inodes */ +int adjnffree[MIBSIZE]; /* MIB cmd to adjust number of free frags */ +int adjnumclusters[MIBSIZE]; /* MIB cmd to adjust number of free clusters */ int adjdepth[MIBSIZE]; /* MIB cmd to adjust directory depth count */ -int freefiles[MIBSIZE]; /* MIB command to free a set of files */ -int freedirs[MIBSIZE]; /* MIB command to free a set of directories */ -int freeblks[MIBSIZE]; /* MIB command to free a set of data blocks */ +int freefiles[MIBSIZE]; /* MIB cmd to free a set of files */ +int freedirs[MIBSIZE]; /* MIB cmd to free a set of directories */ +int freeblks[MIBSIZE]; /* MIB cmd to free a set of data blocks */ struct fsck_cmd cmd; /* sysctl file system update commands */ char snapname[BUFSIZ]; /* when doing snapshots, the name of the file */ char *cdevname; /* name of device being checked */ @@ -91,7 +91,7 @@ char ckclean; /* only do work if not cleanly unmounted */ int cvtlevel; /* convert to newer file system format */ int ckhashadd; /* check hashes to be added */ int bkgrdcheck; /* determine if background check is possible */ -int bkgrdsumadj; /* whether the kernel have ability to adjust superblock summary */ +int bkgrdsumadj; /* kernel able to adjust superblock summary */ char usedsoftdep; /* just fix soft dependency inconsistencies */ char preen; /* just fix normal inconsistencies */ char rerun; /* rerun fsck. Only used in non-preen mode */ diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 60a542785541..56883d682ce8 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -351,16 +351,18 @@ checkfilesys(char *filesys) * Determine if we can and should do journal recovery. */ if ((sblock.fs_flags & FS_SUJ) == FS_SUJ) { - if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && skipclean) { + if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && + skipclean) { sujrecovery = 1; if (suj_check(filesys) == 0) { - printf("\n***** FILE SYSTEM MARKED CLEAN *****\n"); + pwarn("\n**** FILE SYSTEM MARKED CLEAN ****\n"); if (chkdoreload(mntp, pwarn) == 0) exit(0); exit(4); } sujrecovery = 0; - printf("** Skipping journal, falling through to full fsck\n\n"); + pwarn("Skipping journal, " + "falling through to full fsck\n"); } if (fswritefd != -1) { /* diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index d328234220ad..5b27cf8cbfbe 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -104,7 +104,7 @@ pass1(void) if (!reply("REBUILD CYLINDER GROUP")) { cgheader_corrupt = 1; if (!nflag) { - printf("YOU WILL NEED TO RERUN FSCK.\n"); + pwarn("YOU WILL NEED TO RERUN FSCK.\n"); rerun = 1; } } else { diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index 58143a0e8211..d973183eb36a 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -411,43 +411,53 @@ pass5(void) printf("adjndir by %+" PRIi64 "\n", cmd.value); if (bkgrdsumadj == 0 || sysctl(adjndir, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) - rwerror("ADJUST NUMBER OF DIRECTORIES", cmd.value); + rwerror("ADJUST NUMBER OF DIRECTORIES", + cmd.value); } cmd.value = cstotal.cs_nbfree - fs->fs_cstotal.cs_nbfree; if (cmd.value != 0) { if (debug) - printf("adjnbfree by %+" PRIi64 "\n", cmd.value); + printf("adjnbfree by %+" PRIi64 "\n", + cmd.value); if (bkgrdsumadj == 0 || sysctl(adjnbfree, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) - rwerror("ADJUST NUMBER OF FREE BLOCKS", cmd.value); + rwerror("ADJUST NUMBER OF FREE BLOCKS", + cmd.value); } cmd.value = cstotal.cs_nifree - fs->fs_cstotal.cs_nifree; if (cmd.value != 0) { if (debug) - printf("adjnifree by %+" PRIi64 "\n", cmd.value); + printf("adjnifree by %+" PRIi64 "\n", + cmd.value); if (bkgrdsumadj == 0 || sysctl(adjnifree, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) - rwerror("ADJUST NUMBER OF FREE INODES", cmd.value); + rwerror("ADJUST NUMBER OF FREE INODES", + cmd.value); } cmd.value = cstotal.cs_nffree - fs->fs_cstotal.cs_nffree; if (cmd.value != 0) { if (debug) - printf("adjnffree by %+" PRIi64 "\n", cmd.value); + printf("adjnffree by %+" PRIi64 "\n", + cmd.value); if (bkgrdsumadj == 0 || sysctl(adjnffree, MIBSIZE, 0, 0, &cmd, sizeof cmd) == -1) - rwerror("ADJUST NUMBER OF FREE FRAGS", cmd.value); + rwerror("ADJUST NUMBER OF FREE FRAGS", + cmd.value); } - cmd.value = cstotal.cs_numclusters - fs->fs_cstotal.cs_numclusters; + cmd.value = cstotal.cs_numclusters - + fs->fs_cstotal.cs_numclusters; if (cmd.value != 0) { if (debug) - printf("adjnumclusters by %+" PRIi64 "\n", cmd.value); - if (bkgrdsumadj == 0 || sysctl(adjnumclusters, MIBSIZE, 0, 0, - &cmd, sizeof cmd) == -1) - rwerror("ADJUST NUMBER OF FREE CLUSTERS", cmd.value); + printf("adjnumclusters by %+" PRIi64 "\n", + cmd.value); + if (bkgrdsumadj == 0 || sysctl(adjnumclusters, MIBSIZE, + 0, 0, &cmd, sizeof cmd) == -1) + rwerror("ADJUST NUMBER OF FREE CLUSTERS", + cmd.value); } } } diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c index 92f786fda38e..eb0d0d682aef 100644 --- a/sbin/fsck_ffs/suj.c +++ b/sbin/fsck_ffs/suj.c @@ -502,7 +502,8 @@ blk_free(ino_t ino, ufs2_daddr_t bno, int mask, int frags) * deallocate the fragment */ for (i = 0; i < frags; i++) - if ((mask & (1 << i)) == 0 && isclr(blksfree, cgbno +i)) { + if ((mask & (1 << i)) == 0 && + isclr(blksfree, cgbno +i)) { freefrags++; setbit(blksfree, cgbno + i); } @@ -1304,8 +1305,8 @@ ino_trunc(ino_t ino, off_t size) return; } if (debug) - printf("Truncating ino %ju, mode %o to size %jd from size %jd\n", - (uintmax_t)ino, mode, size, cursize); + printf("Truncating ino %ju, mode %o to size %jd from " + "size %jd\n", (uintmax_t)ino, mode, size, cursize); /* Skip datablocks for short links and devices. */ if (mode == 0 || mode == IFBLK || mode == IFCHR || @@ -1511,8 +1512,8 @@ blk_check(struct suj_blk *sblk) sino->si_blkadj = 1; } if (debug) - printf("op %d blk %jd ino %ju lbn %jd frags %d isat %d (%d)\n", - brec->jb_op, blk, (uintmax_t)brec->jb_ino, + printf("op %d blk %jd ino %ju lbn %jd frags %d isat %d " + "(%d)\n", brec->jb_op, blk, (uintmax_t)brec->jb_ino, brec->jb_lbn, brec->jb_frags, isat, frags); /* * If we found the block at this address we still have to @@ -2335,8 +2336,8 @@ restart: recsize <= fs->fs_bsize) goto restart; if (debug) - printf("Found invalid segsize %d > %d\n", - recsize, size); + printf("Found invalid segsize " + "%d > %d\n", recsize, size); recsize = real_dev_bsize; jblocks_advance(suj_jblocks, recsize); continue; @@ -2479,7 +2480,8 @@ suj_check(const char *filesys) cg_apply(cg_adj_blk); cg_apply(cg_check_ino); } - if (preen == 0 && (jrecs > 0 || jbytes > 0) && reply("WRITE CHANGES") == 0) + if (preen == 0 && (jrecs > 0 || jbytes > 0) && + reply("WRITE CHANGES") == 0) return (0); /* * Check block counts of snapshot inodes and @@ -2507,10 +2509,11 @@ suj_check(const char *filesys) sbdirty(); ckfini(1); if (jrecs > 0 || jbytes > 0) { - printf("** %jd journal records in %jd bytes for %.2f%% utilization\n", - jrecs, jbytes, ((float)jrecs / (float)(jbytes / JREC_SIZE)) * 100); - printf("** Freed %jd inodes (%jd dirs) %jd blocks, and %jd frags.\n", - freeinos, freedir, freeblocks, freefrags); + printf("** %jd journal records in %jd bytes for %.2f%% " + "utilization\n", jrecs, jbytes, + ((float)jrecs / (float)(jbytes / JREC_SIZE)) * 100); + printf("** Freed %jd inodes (%jd dirs) %jd blocks, and %jd " + "frags.\n", freeinos, freedir, freeblocks, freefrags); } return (0);