[Ocfs2-tools-devel] [PATCH 20/22] fswreck: make group read/write handle discontig block group.
Tao Ma
tao.ma at oracle.com
Wed Mar 31 21:41:24 PDT 2010
Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
fswreck/chain.c | 13 ++++++++++---
fswreck/group.c | 16 ++++++++++++----
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/fswreck/chain.c b/fswreck/chain.c
index 6c2dbf0..6fc8022 100644
--- a/fswreck/chain.c
+++ b/fswreck/chain.c
@@ -181,9 +181,14 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t blkno,
struct ocfs2_dinode *di;
struct ocfs2_chain_list *cl;
struct ocfs2_chain_rec *cr;
- uint64_t oldblkno;
+ uint64_t oldblkno, gb_blkno;
struct ocfs2_group_desc *bg = NULL;
+ ret = ocfs2_lookup_system_inode(fs, GLOBAL_BITMAP_SYSTEM_INODE,
+ 0, &gb_blkno);
+ if (ret)
+ FSWRK_COM_FATAL(progname, ret);
+
ret = ocfs2_malloc_block(fs->fs_io, &buf);
if (ret)
FSWRK_COM_FATAL(progname, ret);
@@ -279,7 +284,8 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t blkno,
bg = (struct ocfs2_group_desc *)bufgroup;
cr = cl->cl_recs;
- ret = ocfs2_read_group_desc(fs, cr->c_blkno, (char *)bg, 0);
+ ret = ocfs2_read_group_desc(fs, cr->c_blkno, (char *)bg,
+ di->i_blkno != gb_blkno);
if (ret)
FSWRK_COM_FATAL(progname, ret);
@@ -301,7 +307,8 @@ static void mess_up_sys_file(ocfs2_filesys *fs, uint64_t blkno,
"\n", oldblkno, bg->bg_next_group);
}
- ret = ocfs2_write_group_desc(fs, cr->c_blkno, (char *)bg, 0);
+ ret = ocfs2_write_group_desc(fs, cr->c_blkno, (char *)bg,
+ di->i_blkno != gb_blkno);
if (ret)
FSWRK_COM_FATAL(progname, ret);
break;
diff --git a/fswreck/group.c b/fswreck/group.c
index f9ea159..70f841f 100644
--- a/fswreck/group.c
+++ b/fswreck/group.c
@@ -77,7 +77,12 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
struct ocfs2_chain_list *cl;
struct ocfs2_chain_rec *cr;
struct ocfs2_group_desc *bg = NULL, *bg1 = NULL;
- uint64_t newblk;
+ uint64_t newblk, gb_blkno;
+
+ ret = ocfs2_lookup_system_inode(fs, GLOBAL_BITMAP_SYSTEM_INODE,
+ 0, &gb_blkno);
+ if (ret)
+ FSWRK_COM_FATAL(progname, ret);
ret = ocfs2_malloc_block(fs->fs_io, &buf);
if (ret)
@@ -108,7 +113,8 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
FSWRK_COM_FATAL(progname, ret);
cr = cl->cl_recs;
- ret = ocfs2_read_group_desc(fs, cr->c_blkno, bufgroup, 0);
+ ret = ocfs2_read_group_desc(fs, cr->c_blkno, bufgroup,
+ di->i_blkno != gb_blkno);
if (ret)
FSWRK_COM_FATAL(progname, ret);
@@ -141,7 +147,8 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
FSWRK_COM_FATAL(progname, ret);
ret = ocfs2_read_group_desc(fs, bg->bg_next_group,
- bufgroup1, 0);
+ bufgroup1,
+ di->i_blkno != gb_blkno);
if (ret)
FSWRK_COM_FATAL(progname, ret);
@@ -186,7 +193,8 @@ static void damage_group_desc(ocfs2_filesys *fs, uint64_t blkno,
FSWRK_FATAL("Invalid type[%d]\n", type);
}
- ret = ocfs2_write_group_desc(fs, cr->c_blkno, bufgroup, 0);
+ ret = ocfs2_write_group_desc(fs, cr->c_blkno, bufgroup,
+ di->i_blkno != gb_blkno);
if (ret)
FSWRK_COM_FATAL(progname, ret);
--
1.5.5
More information about the Ocfs2-tools-devel
mailing list