[Ocfs2-tools-devel] [PATCH 27/50] fsck.ocfs2: Add REFCOUNT_LOC_INVALID.

Tao Ma tao.ma at oracle.com
Mon Jan 11 07:31:13 PST 2010


Refcount loc can only be valid if the file has refcount flag
set. So if fsck.ocfs2 has found that a file has refcount loc
while it does't have refcount flag set, fsck will reset
i_refcount_loc to 0.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 fsck.ocfs2/fsck.ocfs2.checks.8.in |    6 ++++++
 fsck.ocfs2/pass1.c                |   10 ++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/fsck.ocfs2/fsck.ocfs2.checks.8.in b/fsck.ocfs2/fsck.ocfs2.checks.8.in
index 073b438..44b1e43 100644
--- a/fsck.ocfs2/fsck.ocfs2.checks.8.in
+++ b/fsck.ocfs2/fsck.ocfs2.checks.8.in
@@ -554,6 +554,12 @@ found that a file in a non-refcount volume has refcount flag set.
 
 Answering yes remove this flag from the file.
 
+.SS "REFCOUNT_LOC_INVALID"
+Refcount loc can only be valid if the file has refcount flag set. Fsck has
+found that a file has refcount loc while it does't have refcount flag set.
+
+Answering yes reset refcount loc to zero for the file.
+
 \" pass1b.c
 
 .SS "DUP_CLUSTERS_SYSFILE_CLONE"
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
index ef33d12..edd579f 100644
--- a/fsck.ocfs2/pass1.c
+++ b/fsck.ocfs2/pass1.c
@@ -523,6 +523,16 @@ static void o2fsck_verify_inode_fields(ocfs2_filesys *fs,
 		o2fsck_write_inode(ost, blkno, di);
 	}
 
+	if (ocfs2_refcount_tree(OCFS2_RAW_SB(fs->fs_super)) &&
+	    (!(di->i_dyn_features & OCFS2_HAS_REFCOUNT_FL) &&
+	       di->i_refcount_loc) &&
+	    prompt(ost, PY, PR_REFCOUNT_LOC_INVALID,
+		   "Inode %"PRIu64" doesn't have refcount flag set but have "
+		   "refcount loc set. Clear it?", (uint64_t)di->i_blkno)) {
+		di->i_refcount_loc = 0;
+		o2fsck_write_inode(ost, blkno, di);
+	}
+
 	if (S_ISDIR(di->i_mode)) {
 		o2fsck_bitmap_set(ost->ost_dir_inodes, blkno, NULL);
 		o2fsck_add_dir_parent(&ost->ost_dir_parents, blkno, 0, 0,
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list