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