From patchwork Tue Oct 31 06:07:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10033627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD0FC60327 for ; Tue, 31 Oct 2017 06:08:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB672285C8 for ; Tue, 31 Oct 2017 06:08:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF3FE289C1; Tue, 31 Oct 2017 06:08:25 +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=-6.9 required=2.0 tests=BAYES_00,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 3B995285C8 for ; Tue, 31 Oct 2017 06:08:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752367AbdJaGIX (ORCPT ); Tue, 31 Oct 2017 02:08:23 -0400 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:58809 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbdJaGIW (ORCPT ); Tue, 31 Oct 2017 02:08:22 -0400 Received: from localhost.localdomain (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 31 Oct 2017 00:08:06 -0600 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH 2/2] btrfs-progs: print-tree: Print offset as tree objectid Date: Tue, 31 Oct 2017 14:07:58 +0800 Message-Id: <20171031060758.531-2-wqu@suse.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171031060758.531-1-wqu@suse.com> References: <20171031060758.531-1-wqu@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For case like tree reloc trees and subvolume trees, their key offset is the tree id. For case like tree treloc tree for data reloc tree, The key will be outputted as: (TREE_RELOC ROOT_ITEM 18446744073709551607) The minus number is long and even guys with real engineer brains can't easily get the meaning. This patch will change the output format to: (TREE_RELOC ROOT_ITEM DATA_RELOC_TREE) While for special offset value like 0 or (u64)-1, it's still shown as is. Signed-off-by: Qu Wenruo --- print-tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/print-tree.c b/print-tree.c index 687f871db302..326fafcea763 100644 --- a/print-tree.c +++ b/print-tree.c @@ -794,6 +794,18 @@ void btrfs_print_key(struct btrfs_disk_key *disk_key) case BTRFS_UUID_KEY_RECEIVED_SUBVOL: printf(" 0x%016llx)", (unsigned long long)offset); break; + + /* + * For those key offset, they are points to tree id, print them + * in human readable format other than tree id. + * Especially useful for trees like data/tree reloc tree, whose + * tree id can be minus. + */ + case BTRFS_ROOT_ITEM_KEY: + printf(" "); + print_objectid(stdout, offset, type); + printf(")"); + break; default: if (offset == (u64)-1) printf(" -1)");