All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_db: print freecount in xfs_inobt_rec as unsigned
@ 2018-10-24 22:20 Eric Sandeen
  2018-10-26 15:48 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2018-10-24 22:20 UTC (permalink / raw)
  To: linux-xfs

"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 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs_db: print freecount in xfs_inobt_rec as unsigned
  2018-10-24 22:20 [PATCH] xfs_db: print freecount in xfs_inobt_rec as unsigned Eric Sandeen
@ 2018-10-26 15:48 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2018-10-26 15:48 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

On Wed, Oct 24, 2018 at 05:20:08PM -0500, Eric Sandeen wrote:
> "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>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
> 
> 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 }
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-27  0:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-24 22:20 [PATCH] xfs_db: print freecount in xfs_inobt_rec as unsigned Eric Sandeen
2018-10-26 15:48 ` Darrick J. Wong

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.