From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dkim1.fusionio.com ([66.114.96.53]:41244 "EHLO dkim1.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755679Ab3KFUTN (ORCPT ); Wed, 6 Nov 2013 15:19:13 -0500 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim1.fusionio.com (Postfix) with ESMTP id 475307C0427 for ; Wed, 6 Nov 2013 13:19:13 -0700 (MST) Date: Wed, 6 Nov 2013 15:19:11 -0500 From: Josef Bacik To: Anand Jain CC: , , , Subject: Re: [PATCH 3/4 v2] btrfs-progs: fs show should handle if subvol(s) mounted Message-ID: <20131106201911.GF27784@localhost.localdomain> References: <1383536745-4635-1-git-send-email-anand.jain@oracle.com> <1383536745-4635-3-git-send-email-anand.jain@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" In-Reply-To: <1383536745-4635-3-git-send-email-anand.jain@oracle.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: On Mon, Nov 04, 2013 at 11:45:44AM +0800, Anand Jain wrote: > as of now with out this patch user would see > fsinfo per btrfs mount path but which mean multiple > entry if more than one subvol is mounted of the same > fsid. so this patch will handle that nicely. > > v2: accepts Zach suggested > > Signed-off-by: Anand Jain > --- > cmds-filesystem.c | 90 +++++++++++++++++++++++++++++++++-------------------- > utils.c | 88 ++++++++++++++++++++++++++++++++++++++++++--------- > utils.h | 3 +- > 3 files changed, 130 insertions(+), 51 deletions(-) > > diff --git a/cmds-filesystem.c b/cmds-filesystem.c > index d2cad81..f8e8475 100644 > --- a/cmds-filesystem.c > +++ b/cmds-filesystem.c > @@ -317,6 +317,29 @@ static int print_one_fs(struct btrfs_ioctl_fs_info_args *fs_info, > return 0; > } > > +static void handle_print(char *mnt, char *label) > +{ > + int fd; > + struct btrfs_ioctl_fs_info_args fs_info_arg; > + struct btrfs_ioctl_dev_info_args *dev_info_arg = NULL; > + struct btrfs_ioctl_space_args *space_info_arg; > + > + if (get_fs_info(mnt, &fs_info_arg, &dev_info_arg)) { > + fprintf(stdout, "ERROR: get_fs_info failed\n"); > + return; > + } > + > + fd = open(mnt, O_RDONLY); > + if (fd > 0 && !get_df(fd, &space_info_arg)) { 0 is a valid fd. Thanks, Josef