[Ocfs2-tools-devel] [PATCH 02/10] tools: Added support for recovery generation

Sunil Mushran sunil.mushran at oracle.com
Tue Jul 22 14:44:10 PDT 2008


This patch makes changes in libocfs2, debugfs and sizetest
to accomodate the newest recovery generation field in the journal
header.

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 debugfs.ocfs2/dump.c |    2 ++
 libocfs2/inode.c     |    5 ++++-
 sizetest/sizes.txt   |   16 +++++++++-------
 sizetest/sizetest.c  |    2 +-
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c
index b998211..2f5bcac 100644
--- a/debugfs.ocfs2/dump.c
+++ b/debugfs.ocfs2/dump.c
@@ -265,6 +265,8 @@ void dump_inode(FILE *out, struct ocfs2_dinode *in)
 		if (in->id1.journal1.ij_flags & OCFS2_JOURNAL_DIRTY_FL)
 			fprintf(out, "Dirty ");
 		fprintf(out, "\n");
+		fprintf(out, "\tRecovery Generation: %u\n",
+			in->id1.journal1.ij_recovery_generation);
 	}
 
 	if (flags)
diff --git a/libocfs2/inode.c b/libocfs2/inode.c
index 90f83b2..d556b38 100644
--- a/libocfs2/inode.c
+++ b/libocfs2/inode.c
@@ -99,8 +99,11 @@ static void ocfs2_swap_inode_second(struct ocfs2_dinode *di)
 	else if (di->i_flags & OCFS2_BITMAP_FL) {
 		di->id1.bitmap1.i_used = bswap_32(di->id1.bitmap1.i_used);
 		di->id1.bitmap1.i_total = bswap_32(di->id1.bitmap1.i_total);
-	} else if (di->i_flags & OCFS2_JOURNAL_FL)
+	} else if (di->i_flags & OCFS2_JOURNAL_FL) {
 		di->id1.journal1.ij_flags = bswap_32(di->id1.journal1.ij_flags);
+		di->id1.journal1.ij_recovery_generation =
+			bswap_32(di->id1.journal1.ij_recovery_generation);
+	}
 
 	/* we need to be careful to swap the union member that is in use.
 	 * first the ones that are explicitly marked with flags.. */ 
diff --git a/sizetest/sizes.txt b/sizetest/sizes.txt
index 286a4a3..d03b67c 100644
--- a/sizetest/sizes.txt
+++ b/sizetest/sizes.txt
@@ -1,6 +1,6 @@
 [off]	ocfs2_extent_rec    	[size]
 0x000	e_cpos              	+0x04
-0x004	e_int_clusters         	+0x04
+0x004	e_int_clusters      	+0x04
 0x008	e_blkno             	+0x08
 	Total               	0x010
 
@@ -58,12 +58,12 @@
 0x038	s_blocksize_bits    	+0x04
 0x03C	s_clustersize_bits  	+0x04
 0x040	s_max_slots         	+0x02
-0x042	s_tunefs_flag         	+0x02
+0x042	s_tunefs_flag       	+0x02
 0x044	s_reserved1         	+0x04
 0x048	s_first_cluster_group	+0x08
 0x050	s_label             	+0x40
 0x090	s_uuid              	+0x10
-	Total               	0x0A0
+	Total               	0x140
 
 [off]	ocfs2_local_alloc   	[size]
 0x000	la_bm_off           	+0x04
@@ -96,19 +96,21 @@
 0x064	i_atime_nsec        	+0x04
 0x068	i_ctime_nsec        	+0x04
 0x06C	i_mtime_nsec        	+0x04
-0x070	i_reserved1         	+0x48
+0x070	i_attr              	+0x04
+0x076	i_dyn_features      	+0x02
+0x078	i_reserved2         	+0x40
 0x0B8	id1.i_pad1          	+0x08
 0x0B8	id1.dev1.i_rdev     	+0x08
 0x0B8	id1.bitmap1.i_used  	+0x04
 0x0BC	id1.bitmap1.i_total 	+0x04
 0x0B8	id1.journal1.ij_flags	+0x04
-0x0BC	id1.journal1.ij_pad 	+0x04
-0x0C0	id2.i_super         	+0xA0
+0x0BC	id1.journal1.ij_recovery_generation	+0x04
+0x0C0	id2.i_super         	+0x140
 0x0C0	id2.i_lab           	+0x10
 0x0C0	id2.i_chain         	+0x10
 0x0C0	id2.i_list          	+0x10
 0x0C0	id2.i_symlink       	+0x00
-	Total               	0x160
+	Total               	0x200
 
 [off]	struct ocfs2_dir_entry	[size]
 0x000	inode               	+0x08
diff --git a/sizetest/sizetest.c b/sizetest/sizetest.c
index 071a1e6..35d85f0 100644
--- a/sizetest/sizetest.c
+++ b/sizetest/sizetest.c
@@ -195,7 +195,7 @@ static void print_ocfs2_dinode(void)
 	SHOW_OFFSET(struct ocfs2_dinode, id1.bitmap1.i_used);
 	SHOW_OFFSET(struct ocfs2_dinode, id1.bitmap1.i_total);
 	SHOW_OFFSET(struct ocfs2_dinode, id1.journal1.ij_flags);
-	SHOW_OFFSET(struct ocfs2_dinode, id1.journal1.ij_pad);
+	SHOW_OFFSET(struct ocfs2_dinode, id1.journal1.ij_recovery_generation);
 
 	SHOW_OFFSET(struct ocfs2_dinode, id2.i_super);
 	SHOW_OFFSET(struct ocfs2_dinode, id2.i_lab);
-- 
1.5.4.3




More information about the Ocfs2-tools-devel mailing list