linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fan Chengniang/樊成酿" <fancn.fnst@cn.fujitsu.com>
To: <dsterba@suse.cz>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs-progs: make btrfs qgroups show human readable sizes
Date: Mon, 12 Jan 2015 11:00:55 +0800	[thread overview]
Message-ID: <54B338E7.1060604@cn.fujitsu.com> (raw)
In-Reply-To: <20150109180353.GH3685@twin.jikos.cz>


在 2015年01月10日 02:03, David Sterba 写道:
> On Fri, Jan 09, 2015 at 02:47:05PM +0800, Fan Chengniang wrote:
>> make btrfs qgroups show human readable sizes, using -h option, example:
> Thanks.  Please add all the long options from the 'fi df' subcommands as
> well. As the subcommand is not entierly space & size oriented, I'd like
> to keep the single letter options unallocated for now.
>
I will use --human to subsititute -h option. Should I add other long 
options like --kbytes --mbytes --gbytes --tbytes --si --iec?
>> @@ -80,53 +81,62 @@ static struct {
>>   	char *name;
>>   	char *column_name;
>>   	int need_print;
>> +	int human_readable;
> Would be better to make it more generic and store the format type
> directly, then use it ...
I will merge need_print and human_readable into one variable.
>> @@ -203,11 +221,17 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
>>   		print_qgroup_column_add_blank(BTRFS_QGROUP_QGROUPID, len);
>>   		break;
>>   	case BTRFS_QGROUP_RFER:
>> -		len = printf("%llu", qgroup->rfer);
>> +		if (btrfs_qgroup_columns[column].human_readable)
>> +			len = printf("%s", pretty_size(qgroup->rfer));
>> +		else
>> +			len = printf("%llu", qgroup->rfer);
> ... here instead of the switch, something like
>
> 	pretty_size_mode(number, btrfs_qgroup_columns[column].format);
I wiil try to remove switch.

      reply	other threads:[~2015-01-12  3:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09  6:47 [PATCH] btrfs-progs: make btrfs qgroups show human readable sizes Fan Chengniang
2015-01-09 13:48 ` Christian Robottom Reis
2015-01-09 17:58   ` David Sterba
2015-01-09 18:03 ` David Sterba
2015-01-12  3:00   ` Fan Chengniang/樊成酿 [this message]

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=54B338E7.1060604@cn.fujitsu.com \
    --to=fancn.fnst@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --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).