[Ocfs2-tools-devel] [PATCH 26/50] fsck.ocfs2: Add REFCOUNT_FLAG_INVALID.

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


Refcount file can only exist in a volume with refcount supported,
So if fsck.ocfs2 finds that a file in a non-refcount volume has
refcount flag set, just try to remove it.

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 c8bca83..073b438 100644
--- a/fsck.ocfs2/fsck.ocfs2.checks.8.in
+++ b/fsck.ocfs2/fsck.ocfs2.checks.8.in
@@ -548,6 +548,12 @@ allocator.
 Answering yes will invert the bit in the allocator to match the use of the
 cluster -- either allocated and in use or free.
 
+.SS "REFCOUNT_FLAG_INVALID"
+Refcount file can only exist in a volume with refcount supported, Fsck has
+found that a file in a non-refcount volume has refcount flag set.
+
+Answering yes remove this flag from the file.
+
 \" pass1b.c
 
 .SS "DUP_CLUSTERS_SYSFILE_CLONE"
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
index db4225b..ef33d12 100644
--- a/fsck.ocfs2/pass1.c
+++ b/fsck.ocfs2/pass1.c
@@ -513,6 +513,16 @@ static void o2fsck_verify_inode_fields(ocfs2_filesys *fs,
 		o2fsck_write_inode(ost, blkno, di);
 	}
 
+	if ((di->i_dyn_features & OCFS2_HAS_REFCOUNT_FL) &&
+	    !ocfs2_refcount_tree(OCFS2_RAW_SB(fs->fs_super)) &&
+	    prompt(ost, PY, PR_REFCOUNT_FLAG_INVALID,
+		   "Inode %"PRIu64" has refcount flag set but the volume "
+		   "doesn't support it. Clear it?", (uint64_t)di->i_blkno)) {
+
+		di->i_dyn_features &= ~OCFS2_HAS_REFCOUNT_FL;
+		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