From patchwork Fri May 30 02:19:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 4268541 X-Patchwork-Delegate: dave@jikos.cz Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2D2099F1D6 for ; Fri, 30 May 2014 02:18:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 522AC2035D for ; Fri, 30 May 2014 02:18:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AA152017D for ; Fri, 30 May 2014 02:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754493AbaE3CSF (ORCPT ); Thu, 29 May 2014 22:18:05 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:55708 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752856AbaE3CSE (ORCPT ); Thu, 29 May 2014 22:18:04 -0400 X-IronPort-AV: E=Sophos;i="4.98,938,1392134400"; d="scan'208";a="31220649" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 30 May 2014 10:15:26 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s4U2I1cs009968 for ; Fri, 30 May 2014 10:18:01 +0800 Received: from adam-work.lan (10.167.226.24) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 30 May 2014 10:18:02 +0800 From: Qu Wenruo To: Subject: [PATCH v2] btrfs-progs: Add dev uuid output for print_dev_item(). Date: Fri, 30 May 2014 10:19:04 +0800 Message-ID: <1401416344-1298-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 1.9.3 MIME-Version: 1.0 X-Originating-IP: [10.167.226.24] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- changelog: v2: Remove typos from comment message. --- 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)