On 7/10/2017 3:56 PM, Dan Williams wrote:
On Mon, Jul 10, 2017 at 12:47 PM, Dan Williams <[email protected]> wrote:
On Mon, Jul 10, 2017 at 11:42 AM, Linda Knippers <[email protected]> wrote:
On 07/10/2017 02:26 PM, Dan Williams wrote:
The json output format of the 'list' commands is meant to make it easy
to ingest the data into other tools. However, for direct administrator
use of the utility provide an option to format some numbers for easier
human consumption, similar to the "-h" to du(1). Note that the short
option is "-u" since "-h" is already established as the short option for
"--help".
Before:
# ndctl list --region=7
{
"dev":"region7",
"size":67108864,
"available_size":67108864,
"type":"pmem",
"iset_id":-6382611090938810793,
"badblock_count":8
}
After:
# ndctl list --region=7 --human
{
"dev":"region7",
"size":"64.00 MiB / 67.11 MB",
"available_size":"64.00 MiB / 67.11 MB",
"type":"pmem",
"iset_id":"0xa76c6907811fae57",
"badblock_count":8
}
Cc: Dave Jiang <[email protected]>
Reported-by: Linda Knippers <[email protected]>
Reported-by: Yasunori Goto <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
---
Changes since v1:
* drop the auto-detect and just require the "--human" option for the
different format of the output. This prevents any confusion with
default output behavior (Yasunori)
* include the JEDEC size in addition to the IEC size (i.e. MiB vs MB
etc) (Dave).
I'd rather see us pick one or the other and not provide two values.
Even though this is the human friendly output, it's possible that it could
be used by other programs that know what MB means and know what MiB means
but now would need to know that / doesn't mean to divide one by the other.
I think as long as the units are clear, either one is ok.
I started there, the thing that tipped it for me is that fio is
currently outputting both formats when it displays size data. A script
or another program should not be using the "--human" option, that
should eliminate the opportunity for confusion.
How about this to get rid of the "/" character and more closely match fio?
{
"dev":"region7",
"size":"64.00 MiB (67.11 MB)",
"available_size":"64.00 MiB (67.11 MB)",
"type":"pmem",
"iset_id":"0xa76c6907811fae57",
"badblock_count":8
}
That looks better to this human.
Thanks,
-- ljk
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm