diff options
author | mckusick <mckusick@FreeBSD.org> | 2001-03-21 09:48:03 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2001-03-21 09:48:03 +0000 |
commit | dc0e22cfaf1b407ad08776ab7386543ad024a76c (patch) | |
tree | c406042339ede0ab9e543e4797322cadaef35d82 /sbin/fsck_ffs/pass1.c | |
parent | 37fbaa04c47b8d96f06c60428b244c77e3597218 (diff) | |
download | FreeBSD-src-dc0e22cfaf1b407ad08776ab7386543ad024a76c.zip FreeBSD-src-dc0e22cfaf1b407ad08776ab7386543ad024a76c.tar.gz |
Additions to run checks on live filesystems. This change will not
affect current systems until fsck is modified to use these new
facilities. To try out this change, set the fsck passno to zero
in /etc/fstab to cause the filesystem to be mounted without running
fsck, then run `fsck_ffs -p -B <filesystem>' after the system has
been brought up multiuser to run a background cleanup on <filesystem>.
Note that the <filesystem> in question must have soft updates enabled.
Diffstat (limited to 'sbin/fsck_ffs/pass1.c')
-rw-r--r-- | sbin/fsck_ffs/pass1.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 3d09bd0..3a5e408 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -41,6 +41,7 @@ static const char rcsid[] = #include <sys/param.h> #include <sys/stat.h> +#include <sys/sysctl.h> #include <ufs/ufs/dinode.h> #include <ufs/ufs/dir.h> @@ -265,7 +266,7 @@ checkinode(inumber, idesc) * Fake ndb value so direct/indirect block checks below * will detect any garbage after symlink string. */ - if (dp->di_size < sblock.fs_maxsymlinklen) { + if (dp->di_size < (u_int64_t)sblock.fs_maxsymlinklen) { ndb = howmany(dp->di_size, sizeof(ufs_daddr_t)); if (ndb > NDADDR) { j = ndb - NDADDR; @@ -343,9 +344,20 @@ checkinode(inumber, idesc) printf(" (CORRECTED)\n"); else if (reply("CORRECT") == 0) return; - dp = ginode(inumber); - dp->di_blocks = idesc->id_entryno; - inodirty(); + if (bkgrdflag == 0) { + dp = ginode(inumber); + dp->di_blocks = idesc->id_entryno; + inodirty(); + } else { + cmd.value = idesc->id_number; + cmd.size = idesc->id_entryno - dp->di_blocks; + if (debug) + printf("adjblkcnt ino %d amount %d\n", + (long)cmd.value, cmd.size); + if (sysctl(adjblkcnt, MIBSIZE, 0, 0, + &cmd, sizeof cmd) == -1) + rwerror("ADJUST INODE BLOCK COUNT", cmd.value); + } } return; unknown: |