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 1/2 resend] btrfs-progs: v4, move out print in cmd_df to another function
Date: Thu, 12 Sep 2013 17:42:37 +0200	[thread overview]
Message-ID: <20130912154237.GC6810@twin.jikos.cz> (raw)
In-Reply-To: <1378460273-20647-1-git-send-email-anand.jain@oracle.com>

On Fri, Sep 06, 2013 at 05:37:52PM +0800, Anand Jain wrote:
> +static char *group_type_str(u64 flag)
>  {
> -	struct btrfs_ioctl_space_args *sargs, *sargs_orig;
> -	u64 count = 0, i;
> -	int ret;
> -	int fd;
> -	int e;
> -	char *path;
> -	DIR  *dirstream = NULL;
> -
> -	if (check_argc_exact(argc, 2))
> -		usage(cmd_df_usage);
> -
> -	path = argv[1];
> +	switch (flag & BTRFS_BLOCK_GROUP_TYPE_MASK) {
> +	case BTRFS_BLOCK_GROUP_DATA:
> +		return "data";
> +	case BTRFS_BLOCK_GROUP_SYSTEM:
> +		return "system";
> +	case BTRFS_BLOCK_GROUP_METADATA:
> +		return "metadata";
> +	case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
> +		return "mixed";

I think the profile names should stay unchanged, ie Data, System etc,
and Data+Metadata instead of mixed. We can change the output format
later, but for this preparatory patch I'd stick with what it is.

> +	default:
> +		return "unknown";
> +	}
> +}
>  
> -	fd = open_file_or_dir(path, &dirstream);
> -	if (fd < 0) {
> -		fprintf(stderr, "ERROR: can't access to '%s'\n", path);
> -		return 12;
> +static char *group_profile_str(u64 flag)
> +{
> +	switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
> +	case 0:
> +		return "single";

The 'single' profile was not explicitly mentioned before, I tend to
think that it's better to be consistent with the rest and add it as you
do in this patch.

Sample output:

$ ./btrfs fi df /mnt/enospc/mnt
data, single: total=5.92GiB, used=4.41GiB
system, DUP: total=8.00MiB, used=4.00KiB
system, single: total=4.00MiB, used=0.00
metadata, DUP: total=1.02GiB, used=828.10MiB
metadata, single: total=8.00MiB, used=0.00

looks imho ok.

  parent reply	other threads:[~2013-09-12 15:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30  8:35 [PATCH 0/2] v2, fi show, dev scan and lblkid Anand Jain
2013-08-30  8:35 ` [PATCH 1/2] btrfs-progs: v4, move out print in cmd_df to another function Anand Jain
2013-08-30  8:35 ` [PATCH 2/2] btrfs-progs: use kernel for mounted and lblkid to scan disks Anand Jain
2013-09-06  9:37 ` [PATCH 1/2 resend] btrfs-progs: v4, move out print in cmd_df to another function Anand Jain
2013-09-06  9:37   ` [PATCH v2 2/2] btrfs-progs: use kernel for mounted and lblkid to scan disks Anand Jain
2013-09-12 16:36     ` David Sterba
2013-09-13 10:49       ` Anand Jain
2013-09-13 15:56         ` David Sterba
2013-09-13 16:21           ` David Sterba
2013-09-12 15:42   ` David Sterba [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-13 10:44 [PATCH 1/2 resend] btrfs-progs: v4, move out print in cmd_df to another function 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=20130912154237.GC6810@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).