[Ocfs2-tools-devel] [PATCH 08/10] Ocfs2-tools: Adjust corrupt handlers for fswreck's local_alloc.c

Tristan Ye tristan.ye at oracle.com
Fri Jun 5 00:45:41 PDT 2009


Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 fswreck/include/local_alloc.h |   11 ++++++++---
 fswreck/local_alloc.c         |   26 +++++++++-----------------
 2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/fswreck/include/local_alloc.h b/fswreck/include/local_alloc.h
index 239cfd0..8aea6ae 100644
--- a/fswreck/include/local_alloc.h
+++ b/fswreck/include/local_alloc.h
@@ -25,8 +25,13 @@
 #ifndef __LOCAL_ALLOC_H
 #define __LOCAL_ALLOC_H
 
-void mess_up_local_alloc_empty(ocfs2_filesys *fs, uint16_t slotnum);
-void mess_up_local_alloc_bitmap(ocfs2_filesys *fs, uint16_t slotnum);
-void mess_up_local_alloc_used(ocfs2_filesys *fs, uint16_t slotnum);
+#include "fsck_type.h"
+
+void mess_up_local_alloc_empty(ocfs2_filesys *fs, enum fsck_type type,
+			       uint16_t slotnum);
+void mess_up_local_alloc_bitmap(ocfs2_filesys *fs, enum fsck_type type,
+				uint16_t slotnum);
+void mess_up_local_alloc_used(ocfs2_filesys *fs, enum fsck_type type,
+			      uint16_t slotnum);
 
 #endif		/* __LOCAL_ALLOC_H */
diff --git a/fswreck/local_alloc.c b/fswreck/local_alloc.c
index 2c70a0f..b95efcc 100644
--- a/fswreck/local_alloc.c
+++ b/fswreck/local_alloc.c
@@ -207,14 +207,13 @@ bail:
 }
 
 
-void mess_up_local_alloc_empty(ocfs2_filesys *fs, uint16_t slotnum)
+void mess_up_local_alloc_empty(ocfs2_filesys *fs, enum fsck_type type,
+			       uint16_t slotnum)
 {
 	errcode_t ret;
 	uint64_t blkno;
-	int i;
 	char alloc_inode[OCFS2_MAX_FILENAME_LEN];
 	struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
- 	enum fsck_type types[] = { LALLOC_SIZE, LALLOC_NZ_USED, LALLOC_NZ_BM};
   
 	if (slotnum == UINT16_MAX)
 		slotnum = 0;
@@ -227,22 +226,18 @@ void mess_up_local_alloc_empty(ocfs2_filesys *fs, uint16_t slotnum)
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
-	for ( i = 0; i < ARRAY_ELEMENTS(types); i++) 
-		damage_local_alloc(fs, blkno, types[i]);
+	damage_local_alloc(fs, blkno, type);
 		
 	return;
 }
 
-void mess_up_local_alloc_bitmap(ocfs2_filesys *fs, uint16_t slotnum)
+void mess_up_local_alloc_bitmap(ocfs2_filesys *fs, enum fsck_type type,
+				uint16_t slotnum)
 {
 	errcode_t ret;
 	uint64_t blkno;
-	int i;
 	char alloc_inode[OCFS2_MAX_FILENAME_LEN];
 	struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
- 	enum fsck_type types[] = { 	LALLOC_BM_OVERRUN,
-					LALLOC_BM_STRADDLE,
-					LALLOC_BM_SIZE};
   
 	if (slotnum == UINT16_MAX)
 		slotnum = 0;
@@ -257,20 +252,18 @@ void mess_up_local_alloc_bitmap(ocfs2_filesys *fs, uint16_t slotnum)
 
 	create_local_alloc(fs, blkno);
 
-	for ( i = 0; i < ARRAY_ELEMENTS(types); i++) 
-		damage_local_alloc(fs, blkno, types[i]);
+	damage_local_alloc(fs, blkno, type);
 		
 	return;
 }
 
-void mess_up_local_alloc_used(ocfs2_filesys *fs, uint16_t slotnum)
+void mess_up_local_alloc_used(ocfs2_filesys *fs, enum fsck_type type,
+			      uint16_t slotnum)
 {
 	errcode_t ret;
 	uint64_t blkno;
-	int i;
 	char alloc_inode[OCFS2_MAX_FILENAME_LEN];
 	struct ocfs2_super_block *sb = OCFS2_RAW_SB(fs->fs_super);
- 	enum fsck_type types[] = { LALLOC_USED_OVERRUN, LALLOC_CLEAR };
   
 	if (slotnum == UINT16_MAX)
 		slotnum = 0;
@@ -285,8 +278,7 @@ void mess_up_local_alloc_used(ocfs2_filesys *fs, uint16_t slotnum)
 
 	create_local_alloc(fs, blkno);
 
-	for ( i = 0; i < ARRAY_ELEMENTS(types); i++) 
-		damage_local_alloc(fs, blkno, types[i]);
+	damage_local_alloc(fs, blkno, type);
 		
 	return;
 }
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list