linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.cz
Subject: Re: [PATCH 2/2] btrfs-progs: use kernel for mounted and lblkid to scan disks
Date: Fri, 13 Sep 2013 19:25:20 +0200	[thread overview]
Message-ID: <20130913172520.GP6810@twin.jikos.cz> (raw)
In-Reply-To: <1379071943-27543-3-git-send-email-anand.jain@oracle.com>

On Fri, Sep 13, 2013 at 07:32:23PM +0800, Anand Jain wrote:
> Further, this patch adds new parameters mounted and
> group profile info in the filesystem show output

Sorry to bother you, but the 'further' part of the patch should be
separated out. The core change of the patch is to use libblkid and the
ioctl.

> ---------------
> btrfs fi show
> Label: none  uuid: a2446ecf-68c5-4815-8b63-099d10fc373c mounted: /btrfs
> 	Group profile: metadata: single  metadata: DUP  data: single

I didn't notice that before, this does not bring much information
without the numbers as 'fi df' does. Please drop the printf lines

> @@ -246,34 +338,73 @@ static int cmd_show(int argc, char **argv)
>  	struct list_head *cur_uuid;
>  	char *search = NULL;
>  	int ret;
> -	int where = BTRFS_SCAN_PROC;
> +	int where = 0;
>  	int searchstart = 1;
>  
>  	if( argc > 1 && !strcmp(argv[1],"--all-devices")){
>  		where = BTRFS_SCAN_DEV;
>  		searchstart += 1;
> +	} else if (argc > 1 && !strcmp(argv[1], "--mounted")) {
> +		where = BTRFS_SCAN_MOUNTED;
> +		searchstart += 1;

getopt was not used here, but with the new options it probably should
be, because

> -	if (check_argc_max(argc, searchstart + 1))
> -		usage(cmd_show_usage);
> -
> -	ret = scan_for_btrfs(where, 0);
> -
> -	if (ret){
> -		fprintf(stderr, "ERROR: error %d while scanning\n", ret);
> -		return 1;
> +	if (where == BTRFS_SCAN_DEV) {
> +		if (check_argc_max(argc, searchstart + 1))
> +			usage(cmd_show_usage);
> +	} else if (where == BTRFS_SCAN_MOUNTED) {
> +		if (check_argc_max(argc, searchstart))
> +			usage(cmd_show_usage);
> +	} else {
> +		if (check_argc_max(argc, searchstart))
> +			usage(cmd_show_usage);

this stops to work:

$ btrfs fi show SOME-UUID
btrfs filesystem show: too many arguments


thanks,
david

  reply	other threads:[~2013-09-13 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 11:32 [PATCH 0/2 v3] fi show, dev scan and lblkid Anand Jain
2013-09-13 11:32 ` [PATCH 1/2] btrfs-progs: move out print in cmd_df to another function Anand Jain
2013-09-13 17:01   ` David Sterba
2013-09-13 11:32 ` [PATCH 2/2] btrfs-progs: use kernel for mounted and lblkid to scan disks Anand Jain
2013-09-13 17:25   ` David Sterba [this message]
2013-09-15  4:30     ` Anand Jain
2013-09-16 15:42       ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2013-08-30  8:35 [PATCH 0/2] v2, fi show, dev scan and lblkid Anand Jain
2013-08-30  8:35 ` [PATCH 2/2] btrfs-progs: use kernel for mounted and lblkid to scan disks Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130913172520.GP6810@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).