summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/inode.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2001-03-21 09:48:03 +0000
committermckusick <mckusick@FreeBSD.org>2001-03-21 09:48:03 +0000
commitdc0e22cfaf1b407ad08776ab7386543ad024a76c (patch)
treec406042339ede0ab9e543e4797322cadaef35d82 /sbin/fsck_ffs/inode.c
parent37fbaa04c47b8d96f06c60428b244c77e3597218 (diff)
downloadFreeBSD-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/inode.c')
-rw-r--r--sbin/fsck_ffs/inode.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index 8b2f14b..51df724 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -41,6 +41,7 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
+#include <sys/sysctl.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
@@ -187,7 +188,9 @@ iblock(idesc, ilevel, isize)
continue;
(void)sprintf(buf, "PARTIALLY TRUNCATED INODE I=%lu",
(u_long)idesc->id_number);
- if (dofix(idesc, buf)) {
+ if (usedsoftdep) {
+ pfatal(buf);
+ } else if (dofix(idesc, buf)) {
*ap = 0;
dirty(bp);
}
@@ -481,10 +484,21 @@ clri(idesc, type, flag)
if (preen)
printf(" (CLEARED)\n");
n_files--;
- (void)ckinode(dp, idesc);
- clearinode(dp);
- inoinfo(idesc->id_number)->ino_state = USTATE;
- inodirty();
+ if (bkgrdflag == 0) {
+ (void)ckinode(dp, idesc);
+ inoinfo(idesc->id_number)->ino_state = USTATE;
+ clearinode(dp);
+ inodirty();
+ } else {
+ cmd.value = idesc->id_number;
+ cmd.size = -dp->di_nlink;
+ if (debug)
+ printf("adjrefcnt ino %d amt %d\n",
+ (long)cmd.value, cmd.size);
+ if (sysctl(adjrefcnt, MIBSIZE, 0, 0,
+ &cmd, sizeof cmd) == -1)
+ rwerror("ADJUST INODE", cmd.value);
+ }
}
}
OpenPOWER on IntegriCloud