[Ocfs2-tools-commits] zab commits r449 - in trunk/fsck.ocfs2: . include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Dec 2 16:45:16 CST 2004


Author: zab
Date: 2004-12-02 16:45:14 -0600 (Thu, 02 Dec 2004)
New Revision: 449

Modified:
   trunk/fsck.ocfs2/fsck.c
   trunk/fsck.ocfs2/fsck.ocfs2.8.in
   trunk/fsck.ocfs2/include/fsck.h
   trunk/fsck.ocfs2/pass1.c
Log:
o only ask to repair fs_gen if the user asks with -G
o s/SUPER_BLOCK_FL/VALID_FL/, nurr.
o don't check blocks for files that aren't valid


Modified: trunk/fsck.ocfs2/fsck.c
===================================================================
--- trunk/fsck.ocfs2/fsck.c	2004-12-02 20:51:05 UTC (rev 448)
+++ trunk/fsck.ocfs2/fsck.c	2004-12-02 22:45:14 UTC (rev 449)
@@ -257,7 +257,7 @@
 	setlinebuf(stderr);
 	setlinebuf(stdout);
 
-	while((c = getopt(argc, argv, "b:B:npuvVy")) != EOF) {
+	while((c = getopt(argc, argv, "b:B:GnpuvVy")) != EOF) {
 		switch (c) {
 			case 'b':
 				blkno = read_number(optarg);
@@ -287,6 +287,10 @@
 				ost->ost_force = 1;
 				break;
 
+			case 'G':
+				ost->ost_fix_fs_gen = 1;
+				break;
+
 			case 'n':
 				ost->ost_ask = 0;
 				ost->ost_answer = 0;

Modified: trunk/fsck.ocfs2/fsck.ocfs2.8.in
===================================================================
--- trunk/fsck.ocfs2/fsck.ocfs2.8.in	2004-12-02 20:51:05 UTC (rev 448)
+++ trunk/fsck.ocfs2/fsck.ocfs2.8.in	2004-12-02 22:45:14 UTC (rev 449)
@@ -2,7 +2,7 @@
 .SH "NAME"
 fsck.ocfs2 \- Check an OCFS2 file system.
 .SH "SYNOPSIS"
-\fBfsck.ocfs2\fR [ \fB\-npuvy\fR ] [ \fB\-b\fR \fIsuperblock block\fR ] [ \fB\-B\fR \fIblock size\fR ] \fIdevice\fR
+\fBfsck.ocfs2\fR [ \fB\-Gnpuvy\fR ] [ \fB\-b\fR \fIsuperblock block\fR ] [ \fB\-B\fR \fIblock size\fR ] \fIdevice\fR
 .SH "DESCRIPTION"
 .PP 
 \fBfsck.ocfs2\fR is used to check an OCFS2 file system.
@@ -26,6 +26,13 @@
 effect as the file system is always checked.
 
 .TP
+\fB\-G\fR
+Usually \fBfsck.ocfs2\fR will silently assume inodes whose generation number
+does not match the generation number of the super block are unused inodes.
+This option causes \fBfsck.ocfs2\fR to ask the user if these inodes should in
+fact be marked unused.
+
+.TP
 \fB\-n\fR
 Give the 'no' answer to all questions that fsck will ask.  This guarantees
 that the file system will not be modified and the device will be opened

Modified: trunk/fsck.ocfs2/include/fsck.h
===================================================================
--- trunk/fsck.ocfs2/include/fsck.h	2004-12-02 20:51:05 UTC (rev 448)
+++ trunk/fsck.ocfs2/include/fsck.h	2004-12-02 22:45:14 UTC (rev 449)
@@ -63,7 +63,8 @@
 			ost_write_inode_alloc:1,
 			ost_write_error:1,
 			ost_write_cluster_alloc_asked:1,
-			ost_write_cluster_alloc:1;
+			ost_write_cluster_alloc:1,
+			ost_fix_fs_gen:1;
 } o2fsck_state;
 
 /* The idea is to let someone off-site run fsck and have it give us 

Modified: trunk/fsck.ocfs2/pass1.c
===================================================================
--- trunk/fsck.ocfs2/pass1.c	2004-12-02 20:51:05 UTC (rev 448)
+++ trunk/fsck.ocfs2/pass1.c	2004-12-02 22:45:14 UTC (rev 449)
@@ -175,9 +175,6 @@
 
 	verbosef("checking inode %"PRIu64"'s fields\n", blkno);
 
-	if (!(di->i_flags & OCFS2_VALID_FL))
-		goto out;
-
 	if (di->i_fs_generation != ost->ost_fs_generation) {
 		if (prompt(ost, PY, 0, "Inode read from block %"PRIu64" looks "
 			   "like it is valid but it has a generation of %x "
@@ -260,8 +257,12 @@
 	}
 
 out:
+	/* XXX when we clear we need to also free whatever blocks may have
+	 * hung off this inode that haven't already been reserved.  we want
+	 * to do this on the transition from valid to invalid, not just
+	 * any time we see an invalid inode (somewhat obviously). */
 	if (clear) {
-		di->i_flags &= ~OCFS2_SUPER_BLOCK_FL;
+		di->i_flags &= ~OCFS2_VALID_FL;
 		o2fsck_write_inode(ost, blkno, di);
 	}
 }
@@ -721,14 +722,20 @@
 
 		valid = 0;
 
-		/* scanners have to skip over uninitialized inodes */
+		/* we never consider inodes who don't have a signature.
+		 * We only consider inodes whose generations don't match
+		 * if the user has asked us to */
 		if (!memcmp(di->i_signature, OCFS2_INODE_SIGNATURE,
-		    strlen(OCFS2_INODE_SIGNATURE))) {
-			o2fsck_verify_inode_fields(fs, ost, blkno, di);
+			    strlen(OCFS2_INODE_SIGNATURE)) &&
+		    (ost->ost_fix_fs_gen ||
+		    (di->i_fs_generation == ost->ost_fs_generation))) {
 
-			/* XXX be able to mark the blocks in the inode as 
-			 * bad if the inode was bad */
-			o2fsck_check_blocks(fs, ost, blkno, di);
+			if (di->i_flags & OCFS2_VALID_FL)
+				o2fsck_verify_inode_fields(fs, ost, blkno, di);
+
+			if (di->i_flags & OCFS2_VALID_FL)
+				o2fsck_check_blocks(fs, ost, blkno, di);
+
 			valid = di->i_flags & OCFS2_VALID_FL;
 		}
 



More information about the Ocfs2-tools-commits mailing list