From: Qu Wenruo <wqu@suse.com>
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 [thread overview]
Message-ID: <20171031060758.531-2-wqu@suse.com> (raw)
In-Reply-To: <20171031060758.531-1-wqu@suse.com>
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 <wqu@suse.com>
---
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)");
--
2.14.3
next prev parent reply other threads:[~2017-10-31 6:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 6:07 [PATCH 1/2] btrfs-progs: test/fsck: Introduce test images containing tree reloc tree Qu Wenruo
2017-10-31 6:07 ` Qu Wenruo [this message]
2017-11-09 17:07 ` [PATCH 2/2] btrfs-progs: print-tree: Print offset as tree objectid David Sterba
2017-11-09 17:03 ` [PATCH 1/2] btrfs-progs: test/fsck: Introduce test images containing tree reloc tree David Sterba
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=20171031060758.531-2-wqu@suse.com \
--to=wqu@suse.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).