[Ocfs2-tools-devel] [PATCH 34/50] fsck.ocfs2: Add cluster check for refcount extent tree.

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


As we now use check_el to check the refcount extent tree,
we can get some helpful information from extent_info, such
as ei_clusters and they can be used to rf_clusters.

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

diff --git a/fsck.ocfs2/fsck.ocfs2.checks.8.in b/fsck.ocfs2/fsck.ocfs2.checks.8.in
index a659fbf..3400d30 100644
--- a/fsck.ocfs2/fsck.ocfs2.checks.8.in
+++ b/fsck.ocfs2/fsck.ocfs2.checks.8.in
@@ -643,6 +643,14 @@ It is found refering an invalid refcount block.
 
 Answering yes remove this refcount block.
 
+.SS "REFCOUNT_CLUSTERS"
+Refcount tree contains a record of how many clusters are allocated to them.
+A tree was found whose recorded number of clusters doesn't match the number
+of blocks that were found associated with it.
+
+Answering yes resets the number of clusters to reflect the real number
+of blocks that were associated with the tree.
+
 \" pass1b.c
 
 .SS "DUP_CLUSTERS_SYSFILE_CLONE"
diff --git a/fsck.ocfs2/refcount.c b/fsck.ocfs2/refcount.c
index a475812..365a2c1 100644
--- a/fsck.ocfs2/refcount.c
+++ b/fsck.ocfs2/refcount.c
@@ -243,6 +243,16 @@ static errcode_t check_rb(o2fsck_state *ost, uint64_t blkno,
 		check_el(ost, &ei, rb->rf_blkno, &rb->rf_list,
 			 max_recs, &changed);
 		*c_end = check.c_end;
+
+		if (ei.ei_clusters != rb->rf_clusters &&
+		    prompt(ost, PY, PR_REFCOUNT_CLUSTERS,
+			   "Refcount tree %"PRIu64" claims to have %u "
+			   "clusters, but we only found %u. "
+			   "Fix it?", root_blkno,
+			   rb->rf_clusters, (uint32_t)ei.ei_clusters)) {
+			rb->rf_clusters = ei.ei_clusters;
+			changed = 1;
+		}
 	} else {
 		assert(c_end);
 		check_rl(ost, root_blkno, blkno,
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list