[Ocfs2-tools-devel] [PATCH 50/50] fswreck: Add corruption for DUP_CLUSTERS_ADD_REFCOUNT.

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


DUP_CLUSTERS_ADD_REFCOUNT is used to improve the process
we handle duplicated clusters. So we can just corrupt
the root extent block so that all the refcounted clusters
will be treated as duplicate clusters.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 fswreck/corrupt.c           |    1 +
 fswreck/include/fsck_type.h |    3 ++-
 fswreck/main.c              |    2 ++
 fswreck/refcount.c          |    2 ++
 4 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/fswreck/corrupt.c b/fswreck/corrupt.c
index 51e3133..fc40fd0 100644
--- a/fswreck/corrupt.c
+++ b/fswreck/corrupt.c
@@ -487,6 +487,7 @@ void corrupt_refcount(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum)
 	case REFCOUNT_LIST_EMPTY:
 	case REFCOUNT_REC_REDUNDANT:
 	case REFCOUNT_COUNT_INVALID:
+	case DUP_CLUSTERS_ADD_REFCOUNT:
 		func = mess_up_refcount_tree_block;
 		break;
 	case REFCOUNT_CLUSTERS:
diff --git a/fswreck/include/fsck_type.h b/fswreck/include/fsck_type.h
index d689171..ffe198e 100644
--- a/fswreck/include/fsck_type.h
+++ b/fswreck/include/fsck_type.h
@@ -151,6 +151,7 @@ enum fsck_type
 	REFCOUNT_CLUSTERS,
 	REFCOUNT_REC_REDUNDANT,
 	REFCOUNT_COUNT_INVALID,
+	DUP_CLUSTERS_ADD_REFCOUNT,
 	NUM_FSCK_TYPE
 };
 
@@ -243,6 +244,6 @@ enum fsck_type
  *			REFCOUNT_LIST_USED, REFCOUNT_CLUSTER_RANGE,
  *			REFCOUNT_CLUSTER_COLLISION, REFCOUNT_LIST_EMPTY
  *			REFCOUNT_CLUSTERS, REFCOUNT_REC_REDUNDANT,
- *			REFCOUNT_COUNT_INVALID
+ *			REFCOUNT_COUNT_INVALID,  DUP_CLUSTERS_ADD_REFCOUNT
  */
 #endif
diff --git a/fswreck/main.c b/fswreck/main.c
index 39196f8..1a8e28b 100644
--- a/fswreck/main.c
+++ b/fswreck/main.c
@@ -294,6 +294,8 @@ static struct prompt_code prompt_codes[NUM_FSCK_TYPE] = {
 			   "corrupt the refcount record in a refcount block"),
 	define_prompt_code(REFCOUNT_COUNT_INVALID, corrupt_refcount,
 			   "corrupt the refcount record in a refcount block"),
+	define_prompt_code(DUP_CLUSTERS_ADD_REFCOUNT, corrupt_refcount,
+			   "corrupt refcount record and handle them in dup"),
 };
 
 #undef define_prompt_code
diff --git a/fswreck/refcount.c b/fswreck/refcount.c
index b360f15..4085f1d 100644
--- a/fswreck/refcount.c
+++ b/fswreck/refcount.c
@@ -146,6 +146,7 @@ static void damage_refcount_block(ocfs2_filesys *fs, enum fsck_type type,
 		break;
 	case RB_GEN:
 	case RB_GEN_FIX:
+	case DUP_CLUSTERS_ADD_REFCOUNT:
 		oldno = rb->rf_fs_generation;
 		rb->rf_fs_generation = 0x1234;
 		if (type == RB_GEN)
@@ -307,6 +308,7 @@ void mess_up_refcount_tree_block(ocfs2_filesys *fs, enum fsck_type type,
 	case RB_BLKNO:
 	case RB_GEN:
 	case RB_GEN_FIX:
+	case DUP_CLUSTERS_ADD_REFCOUNT:
 		damage_refcount_block(fs, type, rb1);
 		damage_refcount_block(fs, type, rb2_leaf);
 		break;
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list