diff mbox

Btrfs-progs: do not print uuid 0 when printing root item

Message ID 1371527526-3691-1-git-send-email-wangshilong1991@gmail.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Wang Shilong June 18, 2013, 3:52 a.m. UTC
Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
---
 print-tree.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

David Sterba June 19, 2013, 11:45 a.m. UTC | #1
> do not print uuid 0 when printing root item

Actually I think we should print all the UUIDs unconditionally. This is
inside the debug-tree utility and a zero uuid is an information that may
be useful, even if only as one of the results 'grep uuid'. I don't see
much point in hiding information here, it's a few more lines per root.


david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wang Shilong June 19, 2013, 11:56 a.m. UTC | #2
Hi David,

>> do not print uuid 0 when printing root item
> 
> Actually I think we should print all the UUIDs unconditionally. This is
> inside the debug-tree utility and a zero uuid is an information that may
> be useful, even if only as one of the results 'grep uuid'. I don't see

It is useless to print uuid 0..
If we don't use btrfs send/receive function…uuid is always 0.

> much point in hiding information here, it's a few more lines per root.

It looks strange to me..when i try to debug  tree, uuid 0 is printed out.

Thanks,
Wang
> 
> 
> david

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/print-tree.c b/print-tree.c
index aae47a9..c1d8d18 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -355,8 +355,10 @@  static void print_root(struct extent_buffer *leaf, int slot)
 		(unsigned long long)btrfs_root_generation(&root_item));
 
 	if (root_item.generation == root_item.generation_v2) {
-		uuid_unparse(root_item.uuid, uuid_str);
-		printf("\t\tuuid %s\n", uuid_str);
+		if (count_bytes(root_item.uuid, BTRFS_UUID_SIZE, 0) != BTRFS_UUID_SIZE) {
+			uuid_unparse(root_item.uuid, uuid_str);
+			printf("\t\tuuid %s\n", uuid_str);
+		}
 		if (count_bytes(root_item.parent_uuid, BTRFS_UUID_SIZE, 0) != BTRFS_UUID_SIZE) {
 			uuid_unparse(root_item.parent_uuid, uuid_str);
 			printf("\t\tparent_uuid %s\n", uuid_str);