In the case of a background fsck, periodically update the process title
with a progress update.
This commit is contained in:
parent
e9ba071875
commit
1660ae8795
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126345
@ -258,6 +258,7 @@ ufs2_daddr_t n_blks; /* number of blocks in use */
|
|||||||
ino_t n_files; /* number of files in use */
|
ino_t n_files; /* number of files in use */
|
||||||
|
|
||||||
int got_siginfo; /* received a SIGINFO */
|
int got_siginfo; /* received a SIGINFO */
|
||||||
|
int got_sigalarm; /* received a SIGALRM */
|
||||||
|
|
||||||
#define clearinode(dp) \
|
#define clearinode(dp) \
|
||||||
if (sblock.fs_magic == FS_UFS1_MAGIC) { \
|
if (sblock.fs_magic == FS_UFS1_MAGIC) { \
|
||||||
@ -324,6 +325,7 @@ union dinode *getnextinode(ino_t inumber);
|
|||||||
void getpathname(char *namebuf, ino_t curdir, ino_t ino);
|
void getpathname(char *namebuf, ino_t curdir, ino_t ino);
|
||||||
union dinode *ginode(ino_t inumber);
|
union dinode *ginode(ino_t inumber);
|
||||||
void infohandler(int sig);
|
void infohandler(int sig);
|
||||||
|
void alarmhandler(int sig);
|
||||||
void inocleanup(void);
|
void inocleanup(void);
|
||||||
void inodirty(void);
|
void inodirty(void);
|
||||||
struct inostat *inoinfo(ino_t inum);
|
struct inostat *inoinfo(ino_t inum);
|
||||||
|
@ -78,6 +78,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
struct rlimit rlimit;
|
struct rlimit rlimit;
|
||||||
|
struct itimerval itimerval;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
@ -150,6 +151,14 @@ main(int argc, char *argv[])
|
|||||||
if (preen)
|
if (preen)
|
||||||
(void)signal(SIGQUIT, catchquit);
|
(void)signal(SIGQUIT, catchquit);
|
||||||
signal(SIGINFO, infohandler);
|
signal(SIGINFO, infohandler);
|
||||||
|
if (bkgrdflag) {
|
||||||
|
signal(SIGALRM, alarmhandler);
|
||||||
|
itimerval.it_interval.tv_sec = 5;
|
||||||
|
itimerval.it_interval.tv_usec = 0;
|
||||||
|
itimerval.it_value.tv_sec = 5;
|
||||||
|
itimerval.it_value.tv_usec = 0;
|
||||||
|
setitimer(ITIMER_REAL, &itimerval, NULL);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Push up our allowed memory limit so we can cope
|
* Push up our allowed memory limit so we can cope
|
||||||
* with huge file systems.
|
* with huge file systems.
|
||||||
|
@ -107,6 +107,11 @@ pass1(void)
|
|||||||
c * 100 / sblock.fs_ncg);
|
c * 100 / sblock.fs_ncg);
|
||||||
got_siginfo = 0;
|
got_siginfo = 0;
|
||||||
}
|
}
|
||||||
|
if (got_sigalarm) {
|
||||||
|
setproctitle("%s p1 %d%%", cdevname,
|
||||||
|
c * 100 / sblock.fs_ncg);
|
||||||
|
got_sigalarm = 0;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* If we are using soft updates, then we can trust the
|
* If we are using soft updates, then we can trust the
|
||||||
* cylinder group inode allocation maps to tell us which
|
* cylinder group inode allocation maps to tell us which
|
||||||
|
@ -71,6 +71,11 @@ pass1b(void)
|
|||||||
c * 100 / sblock.fs_ncg);
|
c * 100 / sblock.fs_ncg);
|
||||||
got_siginfo = 0;
|
got_siginfo = 0;
|
||||||
}
|
}
|
||||||
|
if (got_sigalarm) {
|
||||||
|
setproctitle("%s p1b %d%%", cdevname,
|
||||||
|
c * 100 / sblock.fs_ncg);
|
||||||
|
got_siginfo = 0;
|
||||||
|
}
|
||||||
for (i = 0; i < sblock.fs_ipg; i++, inumber++) {
|
for (i = 0; i < sblock.fs_ipg; i++, inumber++) {
|
||||||
if (inumber < ROOTINO)
|
if (inumber < ROOTINO)
|
||||||
continue;
|
continue;
|
||||||
|
@ -140,6 +140,11 @@ pass2(void)
|
|||||||
(int)((inpp - inpsort) * 100 / inplast));
|
(int)((inpp - inpsort) * 100 / inplast));
|
||||||
got_siginfo = 0;
|
got_siginfo = 0;
|
||||||
}
|
}
|
||||||
|
if (got_sigalarm) {
|
||||||
|
setproctitle("%s p2 %d%%", cdevname,
|
||||||
|
(int)((inpp - inpsort) * 100 / inplast));
|
||||||
|
got_sigalarm = 0;
|
||||||
|
}
|
||||||
inp = *inpp;
|
inp = *inpp;
|
||||||
if (inp->i_isize == 0)
|
if (inp->i_isize == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -65,6 +65,11 @@ pass3(void)
|
|||||||
(int)((inplast - inpindex - 1) * 100 / inplast));
|
(int)((inplast - inpindex - 1) * 100 / inplast));
|
||||||
got_siginfo = 0;
|
got_siginfo = 0;
|
||||||
}
|
}
|
||||||
|
if (got_sigalarm) {
|
||||||
|
setproctitle("%s p3 %d%%", cdevname,
|
||||||
|
(int)((inplast - inpindex - 1) * 100 / inplast));
|
||||||
|
got_sigalarm = 0;
|
||||||
|
}
|
||||||
inp = inpsort[inpindex];
|
inp = inpsort[inpindex];
|
||||||
state = inoinfo(inp->i_number)->ino_state;
|
state = inoinfo(inp->i_number)->ino_state;
|
||||||
if (inp->i_number == ROOTINO ||
|
if (inp->i_number == ROOTINO ||
|
||||||
|
@ -68,6 +68,11 @@ pass4(void)
|
|||||||
cg * 100 / sblock.fs_ncg);
|
cg * 100 / sblock.fs_ncg);
|
||||||
got_siginfo = 0;
|
got_siginfo = 0;
|
||||||
}
|
}
|
||||||
|
if (got_sigalarm) {
|
||||||
|
setproctitle("%s p4 %d%%", cdevname,
|
||||||
|
cg * 100 / sblock.fs_ncg);
|
||||||
|
got_sigalarm = 0;
|
||||||
|
}
|
||||||
inumber = cg * sblock.fs_ipg;
|
inumber = cg * sblock.fs_ipg;
|
||||||
for (i = 0; i < inostathead[cg].il_numalloced; i++, inumber++) {
|
for (i = 0; i < inostathead[cg].il_numalloced; i++, inumber++) {
|
||||||
if (inumber < ROOTINO)
|
if (inumber < ROOTINO)
|
||||||
|
@ -157,6 +157,11 @@ pass5(void)
|
|||||||
c * 100 / sblock.fs_ncg);
|
c * 100 / sblock.fs_ncg);
|
||||||
got_siginfo = 0;
|
got_siginfo = 0;
|
||||||
}
|
}
|
||||||
|
if (got_sigalarm) {
|
||||||
|
setproctitle("%s p5 %d%%\n", cdevname,
|
||||||
|
c * 100 / sblock.fs_ncg);
|
||||||
|
got_sigalarm = 0;
|
||||||
|
}
|
||||||
getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize);
|
getblk(&cgblk, cgtod(fs, c), fs->fs_cgsize);
|
||||||
if (!cg_chkmagic(cg))
|
if (!cg_chkmagic(cg))
|
||||||
pfatal("CG %d: BAD MAGIC NUMBER\n", c);
|
pfatal("CG %d: BAD MAGIC NUMBER\n", c);
|
||||||
|
@ -117,3 +117,9 @@ infohandler(int sig __unused)
|
|||||||
{
|
{
|
||||||
got_siginfo = 1;
|
got_siginfo = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
alarmhandler(int sig __unused)
|
||||||
|
{
|
||||||
|
got_sigalarm = 1;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user