From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp1040.oracle.com ([141.146.126.69]:47377 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752136Ab3EJLAO (ORCPT ); Fri, 10 May 2013 07:00:14 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r4AB0DnE017136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 10 May 2013 11:00:14 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4AB0CE4002128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 10 May 2013 11:00:12 GMT Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4AB0BjX010801 for ; Fri, 10 May 2013 11:00:11 GMT From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs-progs: add framework to read fs info and dev info from the kernel Date: Fri, 10 May 2013 19:02:44 +0800 Message-Id: <1368183764-7865-3-git-send-email-anand.jain@oracle.com> In-Reply-To: <1368183764-7865-1-git-send-email-anand.jain@oracle.com> References: <1368183764-7865-1-git-send-email-anand.jain@oracle.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: As of now btrfs fi show reads the disks directly to report the list of fsids and its disks and the output can be inconsistent with the kernel dev changes, mainly after the dev del / add. This patch adds -k|-K option to the btrfs fi show command so that it reads from the kernel instead of from the disks directly. This is done by adding new ioctl BTRFS_IOC_GET_FSIDS and BTRFS_IOC_GET_DEVS to read the fs info and dev info from the kernel. This btrfs-progs changes are inline with the kernel changes as in the patch btrfs: add framework to read fs info and dev info from the kernel Signed-off-by: Anand Jain --- cmds-filesystem.c | 92 ++++++++++++++++++++++++++++++-- ioctl.h | 60 ++++++++++++++++++++- utils.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ utils.h | 2 + 4 files changed, 303 insertions(+), 4 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index f41a72a..d720ce6 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "kerncompat.h" #include "ctree.h" @@ -232,9 +233,11 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices) } static const char * const cmd_show_usage[] = { - "btrfs filesystem show [--all-devices] [|