summaryrefslogtreecommitdiff
path: root/print-tree.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2014-05-30 10:19:04 +0800
committerDavid Sterba <dsterba@suse.cz>2014-08-22 14:39:32 +0200
commit660fe77615ac77909ce3b9d259243781a6206c9a (patch)
tree178434be4bc94ebd15f4b52d4c667cab7aeb520c /print-tree.c
parent8bf2f988bb98aad135741bf4265138f01fe4d423 (diff)
btrfs-progs: Add dev uuid output for print_dev_item().
The original print_dev_item() only prints device id,total bytes and bytes used. When it comes to debug duplicated device id, dev uuid is needed to distinguish different devices since device id is not reliable. (Although the current dev replace implement will reuse the dev uuid, so not really helpful) This patch adds dev uuid output for print_dev_item(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'print-tree.c')
-rw-r--r--print-tree.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/print-tree.c b/print-tree.c
index d46ab422..506cd177 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)