Add a simple SIGINFO handler to fsck_ffs. Shortly after receipt of

a SIGINFO (normally via Ctrl-T), a line will be output indicating
the current phase number and progress information relevant to the
current phase.

Approved by:	mckusick
This commit is contained in:
Ian Dowse 2000-12-15 14:23:55 +00:00
parent e6f0df2b20
commit 6db798cae4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70050
9 changed files with 47 additions and 0 deletions

View File

@ -223,6 +223,8 @@ int lfmode; /* lost & found directory creation mode */
ufs_daddr_t n_blks; /* number of blocks in use */
ufs_daddr_t n_files; /* number of files in use */
int got_siginfo; /* received a SIGINFO */
#define clearinode(dp) (*(dp) = zino)
struct dinode zino;
@ -280,6 +282,7 @@ struct inoinfo *getinoinfo __P((ino_t inumber));
struct dinode *getnextinode __P((ino_t inumber));
void getpathname __P((char *namebuf, ino_t curdir, ino_t ino));
struct dinode *ginode __P((ino_t inumber));
void infohandler __P((int sig));
void inocleanup __P((void));
void inodirty __P((void));
struct inostat *inoinfo __P((ino_t inum));

View File

@ -140,6 +140,7 @@ main(argc, argv)
(void)signal(SIGINT, catch);
if (preen)
(void)signal(SIGQUIT, catchquit);
signal(SIGINFO, infohandler);
/*
* Push up our allowed memory limit so we can cope
* with huge filesystems.

View File

@ -93,6 +93,12 @@ pass1()
inumber = c * sblock.fs_ipg;
setinodebuf(inumber);
inosused = sblock.fs_ipg;
if (got_siginfo) {
printf("%s: phase 1: cyl group %d of %d (%d%%)\n",
cdevname, c, sblock.fs_ncg,
c * 100 / sblock.fs_ncg);
got_siginfo = 0;
}
/*
* If we are using soft updates, then we can trust the
* cylinder group inode allocation maps to tell us which

View File

@ -65,6 +65,12 @@ pass1b()
duphead = duplist;
inumber = 0;
for (c = 0; c < sblock.fs_ncg; c++) {
if (got_siginfo) {
printf("%s: phase 1b: cyl group %d of %d (%d%%)\n",
cdevname, c, sblock.fs_ncg,
c * 100 / sblock.fs_ncg);
got_siginfo = 0;
}
for (i = 0; i < sblock.fs_ipg; i++, inumber++) {
if (inumber < ROOTINO)
continue;

View File

@ -134,6 +134,12 @@ pass2()
dp = &dino;
inpend = &inpsort[inplast];
for (inpp = inpsort; inpp < inpend; inpp++) {
if (got_siginfo) {
printf("%s: phase 2: dir %d of %d (%d%%)\n", cdevname,
inpp - inpsort, inplast, (inpp - inpsort) * 100 /
inplast);
got_siginfo = 0;
}
inp = *inpp;
if (inp->i_isize == 0)
continue;

View File

@ -59,6 +59,12 @@ pass3()
char namebuf[MAXNAMLEN+1];
for (inpindex = inplast - 1; inpindex >= 0; inpindex--) {
if (got_siginfo) {
printf("%s: phase 3: dir %d of %d (%d%%)\n", cdevname,
inplast - inpindex - 1, inplast,
(inplast - inpindex - 1) * 100 / inplast);
got_siginfo = 0;
}
inp = inpsort[inpindex];
state = inoinfo(inp->i_number)->ino_state;
if (inp->i_number == ROOTINO ||

View File

@ -62,6 +62,12 @@ pass4()
idesc.id_type = ADDR;
idesc.id_func = pass4check;
for (cg = 0; cg < sblock.fs_ncg; cg++) {
if (got_siginfo) {
printf("%s: phase 4: cyl group %d of %d (%d%%)\n",
cdevname, cg, sblock.fs_ncg,
cg * 100 / sblock.fs_ncg);
got_siginfo = 0;
}
inumber = cg * sblock.fs_ipg;
for (i = 0; i < inostathead[cg].il_numalloced; i++, inumber++) {
if (inumber < ROOTINO)

View File

@ -169,6 +169,12 @@ pass5()
for (i = fs->fs_size; i < j; i++)
setbmap(i);
for (c = 0; c < fs->fs_ncg; c++) {
if (got_siginfo) {
printf("%s: phase 5: cyl group %d of %d (%d%%)\n",
cdevname, c, sblock.fs_ncg,
c * 100 / sblock.fs_ncg);
got_siginfo = 0;
}
getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize);
if (!cg_chkmagic(cg))
pfatal("CG %d: BAD MAGIC NUMBER\n", c);

View File

@ -101,3 +101,10 @@ blockcheck(origname)
*/
return (origname);
}
void
infohandler(sig)
int sig;
{
got_siginfo = 1;
}