[Ocfs2-tools-devel] [PATCH 1/1] fswreck: update and bug fix.

Tao Ma tao.ma at oracle.com
Sun Jul 27 23:18:23 PDT 2008


fswreck also needs to update for the newly added inline-data.
So update it.

Another 2 bugs are fixed in this patch also.
1. The wrong use of cpu_to_be64.
2. e_leaf_clusters is now only u16, so change it to 2. As we have set
   e_blkno to be the blkno of the last cluster, 2 is enough for us to
   produce the error EXTENT_CLUSTERS_OVERRUN.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 fswreck/corrupt.c      |    2 +-
 fswreck/dir.c          |    4 ++--
 fswreck/extent.c       |    2 +-
 fswreck/group.c        |    2 +-
 fswreck/include/main.h |    1 +
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fswreck/corrupt.c b/fswreck/corrupt.c
index 59a3f81..f698cb0 100644
--- a/fswreck/corrupt.c
+++ b/fswreck/corrupt.c
@@ -94,7 +94,7 @@ static void create_directory(ocfs2_filesys *fs, char *dirname, uint64_t *blkno)
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
-	ret = ocfs2_expand_dir(fs, *blkno, fs->fs_root_blkno);
+	ret = ocfs2_init_dir(fs, *blkno, fs->fs_root_blkno);
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
diff --git a/fswreck/dir.c b/fswreck/dir.c
index bb0844a..3338a17 100644
--- a/fswreck/dir.c
+++ b/fswreck/dir.c
@@ -73,7 +73,7 @@ static void create_directory(ocfs2_filesys *fs,
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
-	ret = ocfs2_expand_dir(fs, *blkno, parentblk);
+	ret = ocfs2_init_dir(fs, *blkno, parentblk);
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
@@ -442,7 +442,7 @@ void mess_up_dir_not_connected(ocfs2_filesys *fs, uint64_t blkno)
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
-	ret = ocfs2_expand_dir(fs, tmp_blkno, blkno);
+	ret = ocfs2_init_dir(fs, tmp_blkno, blkno);
 	if (ret)
 		FSWRK_COM_FATAL(progname, ret);
 
diff --git a/fswreck/extent.c b/fswreck/extent.c
index 3470b37..8903550 100644
--- a/fswreck/extent.c
+++ b/fswreck/extent.c
@@ -313,7 +313,7 @@ static void mess_up_record(ocfs2_filesys *fs, uint64_t blkno,
 			break;
 	 	case EXTENT_CLUSTERS_OVERRUN:
 			oldno = er->e_leaf_clusters;
-			er->e_leaf_clusters = fs->fs_clusters + 1;
+			er->e_leaf_clusters = 2;
 			er->e_blkno = ocfs2_clusters_to_blocks(fs, 
 							fs->fs_clusters - 1);
 			fprintf(stdout, "EXTENT_CLUSTERS_OVERRUN: "
diff --git a/fswreck/group.c b/fswreck/group.c
index 0f758b6..7f17b62 100644
--- a/fswreck/group.c
+++ b/fswreck/group.c
@@ -58,7 +58,7 @@ static void create_test_group_desc(ocfs2_filesys *fs, uint64_t *newblk,
 
 	bg = (struct ocfs2_group_desc *)buf;
 	*bg = *clone;
-	bg->bg_blkno = cpu_to_be64(*newblk);
+	bg->bg_blkno = cpu_to_le64(*newblk);
 	bg->bg_next_group = 0;
 
 	ret = io_write_block(fs->fs_io, *newblk, 1, buf);
diff --git a/fswreck/include/main.h b/fswreck/include/main.h
index 0649014..de9b520 100644
--- a/fswreck/include/main.h
+++ b/fswreck/include/main.h
@@ -51,6 +51,7 @@
 
 #include <linux/types.h>
 
+#include "ocfs2/byteorder.h"
 #include "ocfs2/ocfs2.h"
 
 #define FSWRK_FATAL(fmt, arg...)	({ fprintf(stderr, "ERROR at %s, %d: " fmt ".  EXITING!!!\n", \
-- 
1.5.4.GIT




More information about the Ocfs2-tools-devel mailing list