summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/main.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-10-31 22:06:56 +0000
committerpjd <pjd@FreeBSD.org>2006-10-31 22:06:56 +0000
commit1fff821e2de5fd21ef549a021d018c83de7776e8 (patch)
tree5aa5dca4042a8cf53b45dc5c45fa5dd8fdbdf32f /sbin/fsck_ffs/main.c
parentaaa4c16f6734f951c5260123c5c45a059bee0128 (diff)
downloadFreeBSD-src-1fff821e2de5fd21ef549a021d018c83de7776e8.zip
FreeBSD-src-1fff821e2de5fd21ef549a021d018c83de7776e8.tar.gz
Implements gjournal support. If file system has gjournal support enabled
and -p flag was given perform fast file system checking (bascially only garbage collecting of orphaned objects). Rename bread() to blread() and bwrite() to blwrite() as we now link to the libufs library, which also implement functions with that names. Sponsored by: home.pl
Diffstat (limited to 'sbin/fsck_ffs/main.c')
-rw-r--r--sbin/fsck_ffs/main.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index a717969..2529c87 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -237,6 +237,29 @@ checkfilesys(char *filesys)
exit(7); /* Filesystem clean, report it now */
exit(0);
}
+ if (preen && skipclean) {
+ /*
+ * If file system is gjournaled, check it here.
+ */
+ if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0)
+ exit(3); /* Cannot read superblock */
+ close(fsreadfd);
+ if ((sblock.fs_flags & FS_GJOURNAL) != 0) {
+ //printf("GJournaled file system detected on %s.\n",
+ // filesys);
+ if (sblock.fs_clean == 1) {
+ pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
+ exit(0);
+ }
+ if ((sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0) {
+ gjournal_check(filesys);
+ exit(0);
+ } else {
+ pfatal("UNEXPECTED INCONSISTENCY, %s\n",
+ "CANNOT RUN FAST FSCK\n");
+ }
+ }
+ }
/*
* If we are to do a background check:
* Get the mount point information of the file system
@@ -437,7 +460,7 @@ checkfilesys(char *filesys)
* Write out the duplicate super blocks
*/
for (cylno = 0; cylno < sblock.fs_ncg; cylno++)
- bwrite(fswritefd, (char *)&sblock,
+ blwrite(fswritefd, (char *)&sblock,
fsbtodb(&sblock, cgsblock(&sblock, cylno)),
SBLOCKSIZE);
}
OpenPOWER on IntegriCloud