* [Cluster-devel] [gfs2-utils patch] gfs2_edit: Print block types with log descriptors
[not found] <1436998643.20253580.1402507980230.JavaMail.zimbra@redhat.com>
@ 2014-06-11 17:35 ` Bob Peterson
2014-06-13 16:25 ` Andrew Price
0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2014-06-11 17:35 UTC (permalink / raw)
To: cluster-devel.redhat.com
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@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("<-------------------------");
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [gfs2-utils patch] gfs2_edit: Print block types with log descriptors
2014-06-11 17:35 ` [Cluster-devel] [gfs2-utils patch] gfs2_edit: Print block types with log descriptors Bob Peterson
@ 2014-06-13 16:25 ` Andrew Price
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Price @ 2014-06-13 16:25 UTC (permalink / raw)
To: cluster-devel.redhat.com
On 11/06/14 18:35, Bob Peterson wrote:
> 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.
These look good to me - thanks.
Aside: There's a whole lot of nesting and line splitting going on in
this part of the code, and it's not the only place, so I'd like us all
to start identifying bits like that and refactoring them as we go along,
so that they become a little easier to work with and reason about. Just
something to keep in mind for future work - I don't want to hold up
these improvements.
Cheers,
Andy
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> Signed-off-by: Bob Peterson <rpeterso@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("<-------------------------");
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-13 16:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1436998643.20253580.1402507980230.JavaMail.zimbra@redhat.com>
2014-06-11 17:35 ` [Cluster-devel] [gfs2-utils patch] gfs2_edit: Print block types with log descriptors Bob Peterson
2014-06-13 16:25 ` Andrew Price
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).