From patchwork Wed May 30 07:25:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10437805 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 8795D601E9 for ; Wed, 30 May 2018 07:27:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DF382887A for ; Wed, 30 May 2018 07:27:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62C3328891; Wed, 30 May 2018 07:27: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=-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 D081B2887A for ; Wed, 30 May 2018 07:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935150AbeE3H1W (ORCPT ); Wed, 30 May 2018 03:27:22 -0400 Received: from mgwkm01.jp.fujitsu.com ([202.219.69.168]:30567 "EHLO mgwkm01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934600AbeE3H1W (ORCPT ); Wed, 30 May 2018 03:27:22 -0400 Received: from kw-mxq.gw.nic.fujitsu.com (unknown [192.168.231.130]) by mgwkm01.jp.fujitsu.com with smtp id 1a8a_1d07_949cafe8_0937_4e58_b019_2733fb7dc6ec; Wed, 30 May 2018 16:27:17 +0900 Received: from g01jpfmpwyt01.exch.g01.fujitsu.local (g01jpfmpwyt01.exch.g01.fujitsu.local [10.128.193.38]) by kw-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id 21034AC00B9 for ; Wed, 30 May 2018 16:27:17 +0900 (JST) Received: from g01jpexchyt38.g01.fujitsu.local (unknown [10.128.193.4]) by g01jpfmpwyt01.exch.g01.fujitsu.local (Postfix) with ESMTP id 2FEAD6D6793 for ; Wed, 30 May 2018 16:27:16 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 35b44fc56dcb4ff4a3f6a8033d5f7a6e Subject: [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree block backref From: Misono Tomohiro To: References: Message-ID: <5f258c66-ffde-e7e0-4640-9e3465203c95@jp.fujitsu.com> Date: Wed, 30 May 2018 16:25:50 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable 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 Print tree name instead of number to make output more readable. Example: [before] extent data backref root 5 objectid 257 offset 16384 count 1 tree block backref root 18446744073709551607 [after] extent data backref root FS_TREE objectid 257 offset 16384 count 1 tree block backref root DATA_RELOC_TREE Signed-off-by: Misono Tomohiro Reviewed-by: Nikolay Borisov --- v1 -> v2 - Update extent data backref too - Add output example print-tree.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/print-tree.c b/print-tree.c index 90173c2b..c5be5e6c 100644 --- a/print-tree.c +++ b/print-tree.c @@ -470,8 +470,9 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) offset = btrfs_extent_inline_ref_offset(eb, iref); switch (type) { case BTRFS_TREE_BLOCK_REF_KEY: - printf("\t\ttree block backref root %llu\n", - (unsigned long long)offset); + printf("\t\ttree block backref root "); + print_objectid(stdout, offset, 0); + printf("\n"); break; case BTRFS_SHARED_BLOCK_REF_KEY: printf("\t\tshared block backref parent %llu\n", @@ -479,9 +480,10 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) break; case BTRFS_EXTENT_DATA_REF_KEY: dref = (struct btrfs_extent_data_ref *)(&iref->offset); - printf("\t\textent data backref root %llu " - "objectid %llu offset %lld count %u\n", - (unsigned long long)btrfs_extent_data_ref_root(eb, dref), + printf("\t\textent data backref root "); + print_objectid(stdout, + (unsigned long long)btrfs_extent_data_ref_root(eb, dref), 0); + printf(" objectid %llu offset %lld count %u\n", (unsigned long long)btrfs_extent_data_ref_objectid(eb, dref), btrfs_extent_data_ref_offset(eb, dref), btrfs_extent_data_ref_count(eb, dref)); @@ -1018,9 +1020,10 @@ static void print_extent_data_ref(struct extent_buffer *eb, int slot) struct btrfs_extent_data_ref *dref; dref = btrfs_item_ptr(eb, slot, struct btrfs_extent_data_ref); - printf("\t\textent data backref root %llu " - "objectid %llu offset %llu count %u\n", - (unsigned long long)btrfs_extent_data_ref_root(eb, dref), + printf("\t\textent data backref root "); + print_objectid(stdout, + (unsigned long long)btrfs_extent_data_ref_root(eb, dref), 0); + printf(" objectid %llu offset %llu count %u\n", (unsigned long long)btrfs_extent_data_ref_objectid(eb, dref), (unsigned long long)btrfs_extent_data_ref_offset(eb, dref), btrfs_extent_data_ref_count(eb, dref));