在 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html