From patchwork Wed Oct 24 22:20:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10655047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A689E13A9 for ; Wed, 24 Oct 2018 22:20:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 930AC2B403 for ; Wed, 24 Oct 2018 22:20:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 801F22B41A; Wed, 24 Oct 2018 22:20:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A36F2B403 for ; Wed, 24 Oct 2018 22:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726894AbeJYGuC (ORCPT ); Thu, 25 Oct 2018 02:50:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49900 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726297AbeJYGuC (ORCPT ); Thu, 25 Oct 2018 02:50:02 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FF81C0293BE for ; Wed, 24 Oct 2018 22:20:10 +0000 (UTC) Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA3E410018F9 for ; Wed, 24 Oct 2018 22:20:09 +0000 (UTC) To: linux-xfs From: Eric Sandeen Subject: [PATCH] xfs_db: print freecount in xfs_inobt_rec as unsigned Message-ID: <3fb12611-2ce0-7e8d-0c65-dcbddf5e55b7@redhat.com> Date: Wed, 24 Oct 2018 17:20:08 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 24 Oct 2018 22:20:10 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "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 Reviewed-by: Darrick J. Wong 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 }