All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_db: print freecount in xfs_inobt_rec as unsigned
Date: Wed, 24 Oct 2018 17:20:08 -0500	[thread overview]
Message-ID: <3fb12611-2ce0-7e8d-0c65-dcbddf5e55b7@redhat.com> (raw)

"freecount" in the xfs_inobt_rec is unsigned, so xfs_db should
print it as such.

Not doing so tickles a bug in getbitval() where we try to handle
sign extension for signed fields and fail badly on big endian
machines, causing us to incorrectly report negative numbers when
printing structures even when the number is nowhere near the
signed maximum value.

So this fix works around that bug by properly marking this field
as unsigned, because I have yet to convince myself of the proper
fix for the underlying bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201453
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/db/btblock.c b/db/btblock.c
index cbd2990..5a5b061 100644
--- a/db/btblock.c
+++ b/db/btblock.c
@@ -513,7 +513,7 @@ const field_t	inobt_sprec_flds[] = {
 	{ "holemask", FLDT_UINT16X, OI(ROFF(ir_u.sp.ir_holemask)), C1, 0,
 	  TYP_NONE },
 	{ "count", FLDT_UINT8D, OI(ROFF(ir_u.sp.ir_count)), C1, 0, TYP_NONE },
-	{ "freecount", FLDT_INT8D, OI(ROFF(ir_u.sp.ir_freecount)), C1, 0,
+	{ "freecount", FLDT_UINT8D, OI(ROFF(ir_u.sp.ir_freecount)), C1, 0,
 	  TYP_NONE },
 	{ "free", FLDT_INOFREE, OI(ROFF(ir_free)), C1, 0, TYP_NONE },
 	{ NULL }

             reply	other threads:[~2018-10-25  6:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24 22:20 Eric Sandeen [this message]
2018-10-26 15:48 ` [PATCH] xfs_db: print freecount in xfs_inobt_rec as unsigned Darrick J. Wong

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=3fb12611-2ce0-7e8d-0c65-dcbddf5e55b7@redhat.com \
    --to=sandeen@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 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.