linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: Add dev uuid output for print_dev_item().
@ 2014-05-29  1:02 Qu Wenruo
  2014-05-29 19:52 ` Mike Fleetwood
  0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2014-05-29  1:02 UTC (permalink / raw)
  To: linux-btrfs

The original print_dev_item() only prints device id,total bytes and
bytes used.
When it comes to debug things related to duplicated device id, dev uuid
is needed to distinguish different device since device is is no
reliable.

This patch added dev uuid output.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 print-tree.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/print-tree.c b/print-tree.c
index 574ae9e..cb5c2e1 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -179,11 +179,20 @@ void print_chunk(struct extent_buffer *eb, struct btrfs_chunk *chunk)
 static void print_dev_item(struct extent_buffer *eb,
 			   struct btrfs_dev_item *dev_item)
 {
+	char disk_uuid_c[BTRFS_UUID_UNPARSED_SIZE];
+	u8 disk_uuid[BTRFS_UUID_SIZE];
+
+	read_extent_buffer(eb, disk_uuid,
+			   (unsigned long)btrfs_device_uuid(dev_item),
+			   BTRFS_UUID_SIZE);
+	uuid_unparse(disk_uuid, disk_uuid_c);
 	printf("\t\tdev item devid %llu "
-	       "total_bytes %llu bytes used %Lu\n",
+	       "total_bytes %llu bytes used %Lu\n"
+	       "\t\tdev uuid %s\n",
 	       (unsigned long long)btrfs_device_id(eb, dev_item),
 	       (unsigned long long)btrfs_device_total_bytes(eb, dev_item),
-	       (unsigned long long)btrfs_device_bytes_used(eb, dev_item));
+	       (unsigned long long)btrfs_device_bytes_used(eb, dev_item),
+	       disk_uuid_c);
 }
 
 static void print_uuids(struct extent_buffer *eb)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-02 17:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-29  1:02 [PATCH] btrfs-progs: Add dev uuid output for print_dev_item() Qu Wenruo
2014-05-29 19:52 ` Mike Fleetwood
2014-05-30  0:58   ` Qu Wenruo
2014-06-02 17:43   ` David Sterba

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).