public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 1/4] logprint: use correct ext. header count for unaligned size
Date: Wed, 25 Nov 2015 15:17:54 -0500	[thread overview]
Message-ID: <1448482677-44364-2-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1448482677-44364-1-git-send-email-bfoster@redhat.com>

A log record has 1 record header and up to 7 additional extended record
headers depending on the size of the record. This is required for log
record packing. A header is required for each 32k of record data.

The header count for a particular record is fixed, based on the log
buffer size (h_size) specified in the record header. logprint calculates
the expected extended header count based on h_size, but does not account
for a log buffer size not aligned with 32k. This results in spurious
invalid header count errors for an otherwise valid log. This can be
reproduced by mounting a filesystem with '-o logbsize=16k' and running
xfs_logprint after a subsequent unmount.

Update xlog_print_extended_headers() to incorporate a non-32k aligned
log buffer size in the expected extended record header count
calculation. This is consistent with how the header count is calculated
in the kernel.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 logprint/log_misc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/logprint/log_misc.c b/logprint/log_misc.c
index 4cdcbec..7378fe1 100644
--- a/logprint/log_misc.c
+++ b/logprint/log_misc.c
@@ -1294,6 +1294,8 @@ xlog_print_extended_headers(
 
 	num_required = howmany(len, XLOG_HEADER_CYCLE_SIZE);
 	num_hdrs = be32_to_cpu(hdr->h_size) / XLOG_HEADER_CYCLE_SIZE;
+	if (be32_to_cpu(hdr->h_size) % XLOG_HEADER_CYCLE_SIZE)
+		num_hdrs++;
 
 	if (num_required > num_hdrs) {
 	    print_xlog_bad_reqd_hdrs((*blkno)-1, num_required, num_hdrs);
-- 
2.1.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-11-25 20:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 20:17 [PATCH 0/4] xfsprogs: log format fixes, db command Brian Foster
2015-11-25 20:17 ` Brian Foster [this message]
2015-11-25 20:17 ` [PATCH 2/4] libxfs: format the log with valid log record headers Brian Foster
2015-11-25 20:17 ` [PATCH 3/4] libxfs: conditionalize log format record size optimization Brian Foster
2015-11-25 20:17 ` [PATCH 4/4] db: add the logformat command Brian Foster

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=1448482677-44364-2-git-send-email-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox