diff options
author | scottl <scottl@FreeBSD.org> | 2013-12-30 01:16:08 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2013-12-30 01:16:08 +0000 |
commit | f0d9289d4bc1cea75e6ade6e0b1496020b81d254 (patch) | |
tree | 3f5b4ba557bcb5004e79798d6d96972dfe7d2e45 /sbin/fsck_ffs/fsutil.c | |
parent | 3652e600422dfba0018864e0430f86f9fae07bbd (diff) | |
download | FreeBSD-src-f0d9289d4bc1cea75e6ade6e0b1496020b81d254.zip FreeBSD-src-f0d9289d4bc1cea75e6ade6e0b1496020b81d254.tar.gz |
Add the -R option to allow fsck_ffs to restart itself when too many critical
errors have been detected in a particular run.
Clean up the global state variables so that a restart can happen correctly.
Separate the global variables in fsck_ffs and fsdb to their own file. This
fixes header sharing with fscd.
Correctly initialize, static-ize, and remove global variables as needed in
dir.c. This fixes a problem with lost+found directories that was causing
a segfault.
Correctly initialize, static-ize, and remove global variables as needed in
suj.c.
Initialize the suj globals before allocating the disk object, not after.
Also ensure that 'preen' mode doesn't conflict with 'restart' mode
Submitted by: scottl, max
Reviewed by: max, mckusick (earlier version)
Obtained from: Netflix
MFC after: 3 days
Diffstat (limited to 'sbin/fsck_ffs/fsutil.c')
-rw-r--r-- | sbin/fsck_ffs/fsutil.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 16ef819..4b44fd4 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -74,6 +74,25 @@ static struct bufarea cgblk; /* backup buffer for cylinder group blocks */ static TAILQ_HEAD(buflist, bufarea) bufhead; /* head of buffer cache list */ static int numbufs; /* size of buffer cache */ static char *buftype[BT_NUMBUFTYPES] = BT_NAMES; +static struct bufarea *cgbufs; /* header for cylinder group cache */ +static int flushtries; /* number of tries to reclaim memory */ + +void +fsutilinit(void) +{ + diskreads = totaldiskreads = totalreads = 0; + bzero(&startpass, sizeof(struct timespec)); + bzero(&finishpass, sizeof(struct timespec)); + bzero(&slowio_starttime, sizeof(struct timeval)); + slowio_delay_usec = 10000; + slowio_pollcnt = 0; + bzero(&cgblk, sizeof(struct bufarea)); + TAILQ_INIT(&bufhead); + numbufs = 0; + /* buftype ? */ + cgbufs = NULL; + flushtries = 0; +} int ftypeok(union dinode *dp) |