From: "Darrick J. Wong" <djwong@kernel.org>
To: Donald Douwsma <ddouwsma@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs_logprint: print misc buffers when using -o
Date: Thu, 28 Jan 2021 09:35:13 -0800 [thread overview]
Message-ID: <20210128173513.GQ7698@magnolia> (raw)
In-Reply-To: <20210128073708.25572-2-ddouwsma@redhat.com>
On Thu, Jan 28, 2021 at 06:37:07PM +1100, Donald Douwsma wrote:
> Logprint only dumps raw buffers for unhandled misc buffer types, but
> this information is generally useful when debugging logprint issues so
> allow it to print whenever -o is used.
>
> Switch to using the common xlog_print_data function to dump the buffer.
>
> Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
> ---
> logprint/log_misc.c | 19 +++----------------
> logprint/log_print_all.c | 2 +-
> 2 files changed, 4 insertions(+), 17 deletions(-)
>
> diff --git a/logprint/log_misc.c b/logprint/log_misc.c
> index c325f046..d44e9ff7 100644
> --- a/logprint/log_misc.c
> +++ b/logprint/log_misc.c
> @@ -392,23 +392,10 @@ xlog_print_trans_buffer(char **ptr, int len, int *i, int num_ops)
> }
> } else {
> printf(_("BUF DATA\n"));
> - if (print_data) {
> - uint *dp = (uint *)*ptr;
> - int nums = be32_to_cpu(head->oh_len) >> 2;
> - int byte = 0;
> -
> - while (byte < nums) {
> - if ((byte % 8) == 0)
> - printf("%2x ", byte);
> - printf("%8x ", *dp);
> - dp++;
> - byte++;
> - if ((byte % 8) == 0)
> - printf("\n");
> - }
> - printf("\n");
> - }
Nitpicking: One patch to collapse this into a xlog_recover_print_data
call as a no-functional-changes cleanup, then a second patch to make the
buffer dumps happen any time -D or -o are specified.
TBH the sb/agheader decoders probably need some serious updating to
handle newer fields. It's also unfortunate that xfs_db doesn't know how
to decode log buffers; adding such a thing would be a neat way to enable
targetted fuzzing of log recovery.
--D
> }
> +
> + xlog_recover_print_data(*ptr, be32_to_cpu(head->oh_len));
> +
> *ptr += be32_to_cpu(head->oh_len);
> }
> if (head && head->oh_flags & XLOG_CONTINUE_TRANS)
> diff --git a/logprint/log_print_all.c b/logprint/log_print_all.c
> index eafffe28..2b9e810d 100644
> --- a/logprint/log_print_all.c
> +++ b/logprint/log_print_all.c
> @@ -176,8 +176,8 @@ xlog_recover_print_buffer(
> } else {
> printf(_(" BUF DATA\n"));
> if (!print_buffer) continue;
> - xlog_recover_print_data(p, len);
> }
> + xlog_recover_print_data(p, len);
> }
> }
>
> --
> 2.27.0
>
next prev parent reply other threads:[~2021-01-28 17:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 7:37 [PATCH 0/2] xfsprogs: xfs_logprint misc log decoding issues Donald Douwsma
2021-01-28 7:37 ` [PATCH 1/2] xfs_logprint: print misc buffers when using -o Donald Douwsma
2021-01-28 17:35 ` Darrick J. Wong [this message]
2021-01-28 21:51 ` Donald Douwsma
2021-01-28 7:37 ` [PATCH 2/2] xfs_logprint: decode superblock updates correctly Donald Douwsma
2021-01-28 17:28 ` Darrick J. Wong
2021-01-28 21:59 ` Donald Douwsma
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=20210128173513.GQ7698@magnolia \
--to=djwong@kernel.org \
--cc=ddouwsma@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox