[Ocfs2-tools-commits] mfasheh commits r288 -
branches/dlm-changes/debugfs.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Sep 29 18:55:04 CDT 2004
Author: mfasheh
Date: 2004-09-29 18:55:02 -0500 (Wed, 29 Sep 2004)
New Revision: 288
Modified:
branches/dlm-changes/debugfs.ocfs2/commands.c
Log:
* add a command to debugfs to show an extent block by block number
Modified: branches/dlm-changes/debugfs.ocfs2/commands.c
===================================================================
--- branches/dlm-changes/debugfs.ocfs2/commands.c 2004-09-29 22:52:52 UTC (rev 287)
+++ branches/dlm-changes/debugfs.ocfs2/commands.c 2004-09-29 23:55:02 UTC (rev 288)
@@ -62,6 +62,7 @@
static void do_vote (char **args);
static void do_journal (char **args);
static void do_group (char **args);
+static void do_header (char **args);
extern gboolean allow_write;
extern gboolean no_raw_bind;
@@ -121,7 +122,8 @@
{ "logdump", do_journal },
- { "group", do_group }
+ { "group", do_group },
+ { "header", do_header }
};
@@ -752,6 +754,65 @@
} /* do_group */
/*
+ * do_header()
+ *
+ */
+static void do_header (char **args)
+{
+ char *opts = args[1];
+ ocfs2_extent_block *eb;
+ __u32 blknum;
+ char *buf = NULL;
+ __u32 buflen;
+ FILE *out;
+ __u64 off;
+
+ if (gbls.dev_fd == -1) {
+ printf ("device not open\n");
+ goto bail;
+ }
+
+ buflen = 1 << gbls.blksz_bits;
+ if (!(buf = memalign(buflen, buflen)))
+ DBGFS_FATAL("%s", strerror(errno));
+
+ if (!opts) {
+ printf("no block number specified\n");
+ goto bail;
+ }
+
+ blknum = atoi(opts);
+ if (blknum > gbls.max_blocks) {
+ printf("block number is too large\n");
+ goto bail;
+ }
+
+ off = blknum << gbls.blksz_bits;
+ if ((pread64 (gbls.dev_fd, buf, buflen, off)) == -1) {
+ printf("error reading block!\n");
+ goto bail;
+ }
+
+ out = open_pager();
+
+ eb = (ocfs2_extent_block *)buf;
+ if (memcmp(eb->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE,
+ sizeof(OCFS2_EXTENT_BLOCK_SIGNATURE))) {
+ printf("Not an extent block\n");
+ goto bail;
+ }
+
+ dump_extent_block(out, eb);
+ dump_extent_list(out, &eb->h_list);
+
+ close_pager (out);
+
+bail:
+ safefree (buf);
+ return ;
+} /* do_header */
+
+/*
* handle_signal()
*
*/
More information about the Ocfs2-tools-commits
mailing list