[Cluster-devel] [gfs2-utils patch] gfs2_edit: Print block types with log descriptors
Bob Peterson
rpeterso at redhat.com
Wed Jun 11 17:35:40 UTC 2014
Hi,
This patch makes gfs2_edit's journal print function print the metadata
block type along side the block number in its log descriptor output.
For example: In the past, when a log descriptor was printed, it looked
like this:
0x8200 (j+ 163): Log descriptor, type 300 (Metadata) len:504, data1: 503 (503)
0x70eb772 0x70df987 0x70dc7a1 0x70eb574
0x70dc5a3 0x70eb376 0x70dc3a5 0x70eb178
0x70dc1a7 0x70eaf7a 0x70dbfa9 0x70ead7c
With this patch, the output is more useful:
0x8200 (j+ 163): Log descriptor, type 300 (Metadata) len:504, data1: 503 (503)
0x70eb772 in 0x70df987 rb 0x70dc7a1 in 0x70eb574 in
0x70dc5a3 in 0x70eb376 in 0x70dc3a5 in 0x70eb178 in
0x70dc1a7 in 0x70eaf7a in 0x70dbfa9 in 0x70ead7c in
In this case, "in" indicates indirect blocks, and "rb" indicates a rgrp bitmap.
This is useful for getting a bigger picture of what that journal descriptor
contains and represents.
Regards,
Bob Peterson
Red Hat File Systems
Signed-off-by: Bob Peterson <rpeterso at redhat.com>
---
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 541684a..f23c581 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -27,6 +27,7 @@ enum dsp_mode { HEX_MODE = 0, GFS2_MODE = 1, EXTENDED_MODE = 2, INIT_MODE = 3 };
#define RGLIST_DUMMY_BLOCK -2
#define JOURNALS_DUMMY_BLOCK -3
+extern const char *mtypes[];
extern struct gfs2_sb sb;
extern uint64_t block;
extern int blockhist;
diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c
index bb56649..a72a044 100644
--- a/gfs2/edit/journal.c
+++ b/gfs2/edit/journal.c
@@ -202,6 +202,7 @@ static int print_ld_blks(const uint64_t *b, const char *end, int start_line,
{
int bcount = 0, found_tblk = 0, found_bblk = 0;
static char str[256];
+ struct gfs2_buffer_head *j_bmap_bh;
if (tblk_off)
*tblk_off = 0;
@@ -218,8 +219,17 @@ static int print_ld_blks(const uint64_t *b, const char *end, int start_line,
}
bcount++;
if (prnt) {
- sprintf(str, "0x%llx",
- (unsigned long long)be64_to_cpu(*b));
+ if (is_meta_ld) {
+ j_bmap_bh = bread(&sbd, abs_block +
+ bcount);
+ sprintf(str, "0x%llx %2s",
+ (unsigned long long)be64_to_cpu(*b),
+ mtypes[lgfs2_get_block_type(j_bmap_bh)]);
+ brelse(j_bmap_bh);
+ } else {
+ sprintf(str, "0x%llx",
+ (unsigned long long)be64_to_cpu(*b));
+ }
print_gfs2("%-18.18s ", str);
}
if (!found_tblk && tblk_off)
@@ -237,7 +247,6 @@ static int print_ld_blks(const uint64_t *b, const char *end, int start_line,
int type, bmap = 0;
uint64_t o;
struct gfs2_buffer_head *save_bh;
- struct gfs2_buffer_head *j_bmap_bh;
found_bblk = 1;
print_gfs2("<-------------------------");
More information about the Cluster-devel
mailing list