From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [gfs2-utils patch] gfs2_edit: Print block types with log descriptors
Date: Fri, 13 Jun 2014 17:25:20 +0100 [thread overview]
Message-ID: <539B25F0.6030505@redhat.com> (raw)
In-Reply-To: <860457490.20256457.1402508140711.JavaMail.zimbra@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("<-------------------------");
>
prev parent reply other threads:[~2014-06-13 16:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=539B25F0.6030505@redhat.com \
--to=anprice@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.