[Ocfs2-tools-devel] [PATCH 09/12] debugfs.ocfs2: Dump the ocfs2_block_check structure (metaecc)

Joel Becker joel.becker at oracle.com
Mon Dec 29 19:23:45 PST 2008


The metaecc feature uses the ocfs2_block_check structure.  debugfs.ocfs2
can now dump that field wherever it finds it.

Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
 debugfs.ocfs2/dump.c         |   22 ++++++++++++++++++++++
 debugfs.ocfs2/include/dump.h |    1 +
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/debugfs.ocfs2/dump.c b/debugfs.ocfs2/dump.c
index 2bd2032..2cba747 100644
--- a/debugfs.ocfs2/dump.c
+++ b/debugfs.ocfs2/dump.c
@@ -155,6 +155,20 @@ void dump_fast_symlink (FILE *out, char *link)
 }
 
 /*
+ * dump_block_check
+ *
+ */
+void dump_block_check(FILE *out, struct ocfs2_block_check *bc)
+{
+	if (ocfs2_meta_ecc(OCFS2_RAW_SB(gbls.fs->fs_super)))
+		fprintf(out, "\tCRC32: %"PRIu32"   ECC: %"PRIu16"\n",
+			le32_to_cpu(bc->bc_crc32e),
+			le16_to_cpu(bc->bc_ecc));
+	else
+		fprintf(out, "\tCRC32: N/A   ECC: N/A\n");
+}
+
+/*
  * dump_inode()
  *
  */
@@ -230,6 +244,8 @@ void dump_inode(FILE *out, struct ocfs2_dinode *in)
 	fprintf(out, "\tFS Generation: %u (0x%x)\n", in->i_fs_generation,
 		in->i_fs_generation);
 
+	dump_block_check(out, &in->i_check);
+
 	fprintf(out, "\tType: %s   Attr: 0x%x   Flags: %s\n", str, in->i_attr,
 		flags->str);
 
@@ -378,6 +394,8 @@ void dump_extent_block (FILE *out, struct ocfs2_extent_block *blk)
 	fprintf (out, "\tBlknum: %"PRIu64"   Next Leaf: %"PRIu64"\n",
 		 (uint64_t)blk->h_blkno, (uint64_t)blk->h_next_leaf_blk);
 
+	dump_block_check(out, &blk->h_check);
+
 	return ;
 }
 
@@ -396,6 +414,8 @@ void dump_group_descriptor (FILE *out, struct ocfs2_group_desc *grp,
 			 grp->bg_chain,
 			 (uint64_t)grp->bg_parent_dinode,
 			 grp->bg_generation);
+		dump_block_check(out, &grp->bg_check);
+
 		fprintf(out, "\t##   %-15s   %-6s   %-6s   %-6s   %-6s   %-6s\n",
 			"Block#", "Total", "Used", "Free", "Contig", "Size");
 	}
@@ -466,6 +486,8 @@ int dump_dir_trailers(struct ocfs2_dir_entry *rec, int offset, int blocksize,
                 "\tDirblock: %-15"PRIu64" Inode: %-15"PRIu64" rec_len: %-4u\n",
                 trailer->db_blkno, trailer->db_parent_dinode,
                 trailer->db_compat_rec_len);
+        dump_block_check(ctxt->out, &trailer->db_check);
+
 	return 0;
 }
 
diff --git a/debugfs.ocfs2/include/dump.h b/debugfs.ocfs2/include/dump.h
index f300559..ecb070a 100644
--- a/debugfs.ocfs2/include/dump.h
+++ b/debugfs.ocfs2/include/dump.h
@@ -64,5 +64,6 @@ void dump_inode_path (FILE *out, uint64_t blkno, char *path);
 void dump_logical_blkno(FILE *out, uint64_t blkno);
 void dump_icheck(FILE *out, int hdr, uint64_t blkno, uint64_t inode,
 		 int validoffset, uint64_t offset, int status);
+void dump_block_check(FILE *out, struct ocfs2_block_check *bc);
 
 #endif		/* __DUMP_H__ */
-- 
1.5.6.5




More information about the Ocfs2-tools-devel mailing list