[Ocfs2-tools-devel] [PATCH 30/50] fsck.ocfs2: Clear REFCOUNTED flag if the file doesn't support it.

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


If an extent record has the REFCOUNTED flag set, but neither the filesystem
nor the file has the REFCOUNTED flag set, we should clear it.

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

diff --git a/fsck.ocfs2/extent.c b/fsck.ocfs2/extent.c
index 0d6878b..bd1ccff 100644
--- a/fsck.ocfs2/extent.c
+++ b/fsck.ocfs2/extent.c
@@ -367,6 +367,19 @@ errcode_t o2fsck_check_extent_rec(o2fsck_state *ost,
 		*changed = 1;
 	}
 
+	if (((!ocfs2_refcount_tree(sb)) ||
+	     !(di->i_dyn_features & OCFS2_HAS_REFCOUNT_FL)) &&
+	    (er->e_flags & OCFS2_EXT_REFCOUNTED) &&
+	    prompt(ost, PY, PR_EXTENT_MARKED_REFCOUNTED,
+		   "The extent record for cluster offset %"PRIu32" at block "
+		   "%"PRIu64" in inode %"PRIu64" has the REFCOUNTED flag set, "
+		   "while it shouldn't have that flag. "
+		   "Clear the REFCOUNTED flag?", er->e_cpos, er->e_blkno,
+		   (uint64_t)di->i_blkno)) {
+		er->e_flags &= ~OCFS2_EXT_REFCOUNTED;
+		*changed = 1;
+	}
+
 	return 0;
 }
 
diff --git a/fsck.ocfs2/fsck.ocfs2.checks.8.in b/fsck.ocfs2/fsck.ocfs2.checks.8.in
index 44b1e43..f0b926c 100644
--- a/fsck.ocfs2/fsck.ocfs2.checks.8.in
+++ b/fsck.ocfs2/fsck.ocfs2.checks.8.in
@@ -54,6 +54,12 @@ feature set does not include unwritten extents.
 Answering yes clears the UNWRITTEN flag.  This is safe to do; as the
 feature is disabled anyway.
 
+.SS "EXTENT_MARKED_REFCOUNTED"
+An extent record has the REFCOUNTED flag set, but neither the filesystem
+nor the file has the REFCOUNTED flag set.
+
+Answering yes clears the REFCOUNTED flag.
+
 .SS "EXTENT_BLKNO_UNALIGNED"
 The block that marks the start of an extent should always fall on the start
 of a cluster.  An extent was found that starts part-way into a cluster.
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list