* [PATCH v2 0/3] add columns for zoned parameters @ 2021-08-27 7:34 Naohiro Aota 2021-08-27 7:34 ` [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes Naohiro Aota ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Naohiro Aota @ 2021-08-27 7:34 UTC (permalink / raw) To: Karel Zak; +Cc: util-linux, Damien.LeMoal, Naohiro Aota Several parameters for zoned devices are missing from lsblk's columns. This series introduces them as following. Column Name Description Sysfs path ------------------------------------------------------------------ ZONE-SZ zone size queue/chunk_sectors ZONE-GRAN zone write granularity queue/zone_write_granularity ZONE-APP zone append max bytes queue/zone_append_max_bytes ZONE-NR number of zones queue/nr_zones ZONE-OMAX max open zones queue/max_open_zones ZONE-AMAX max active zones queue/max_active_zones These columns are also added to the "-z" output. Sample output: $ lsblk -z -i NAME ZONED ZONE-SZ ZONE-NR ZONE-AMAX ZONE-OMAX ZONE-APP ZONE-GRAN sda host-managed 256M 55880 0 128 672K 4K sdb host-managed 256M 55880 0 128 672K 4K zram0 none 0B 0 0 0 0B 0B nvme2n1 none 0B 0 0 0 0B 0B |-nvme2n1p1 none 0B 0 0 0 0B 0B |-nvme2n1p2 none 0B 0 0 0 0B 0B `-nvme2n1p3 none 0B 0 0 0 0B 0B nvme0n1 none 0B 0 0 0 0B 0B nvme1n1 none 0B 0 0 0 0B 0B nvme0n2 host-managed 2G 1844 14 14 4M 4K nvme1n2 host-managed 2G 1844 14 14 4M 4K $ lsblk --help|grep -i zone -z, --zoned print zone model ZONED zone model ZONE-SZ zone size ZONE-GRAN zone write granularity ZONE-APP zone append max bytes ZONE-NR number of zones ZONE-OMAX max open zones ZONE-AMAX max active zones Naohiro Aota (3): lsblk: factor out function to read sysfs param as bytes lsblk: add columns of zoned parameters lsblk: add zoned columns to "lsblk -z" bash-completion/lsblk | 3 +- misc-utils/lsblk.8.adoc | 2 +- misc-utils/lsblk.c | 103 ++++++++++++++++++++++++++++++---------- 3 files changed, 81 insertions(+), 27 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes 2021-08-27 7:34 [PATCH v2 0/3] add columns for zoned parameters Naohiro Aota @ 2021-08-27 7:34 ` Naohiro Aota 2021-08-29 23:07 ` Damien Le Moal 2021-08-27 7:34 ` [PATCH v2 2/3] lsblk: add columns of zoned parameters Naohiro Aota 2021-08-27 7:34 ` [PATCH v2 3/3] lsblk: add zoned columns to "lsblk -z" Naohiro Aota 2 siblings, 1 reply; 12+ messages in thread From: Naohiro Aota @ 2021-08-27 7:34 UTC (permalink / raw) To: Karel Zak; +Cc: util-linux, Damien.LeMoal, Naohiro Aota Factor out a new function device_read_bytes() to read a sysfs path as bytes for a preparation for the next commit and to reduce the code duplication. Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> --- misc-utils/lsblk.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 100eba0779f8..775a6d832076 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -708,6 +708,24 @@ static uint64_t device_get_discard_granularity(struct lsblk_device *dev) return dev->discard_granularity; } +static void device_read_bytes(struct lsblk_device *dev, char *path, char **str, + uint64_t *sortdata) +{ + if (lsblk->bytes) { + ul_path_read_string(dev->sysfs, str, path); + if (sortdata) + str2u64(*str, sortdata); + } else { + uint64_t x; + + if (ul_path_read_u64(dev->sysfs, &x, path) == 0) { + *str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); + if (sortdata) + *sortdata = x; + } + } +} + /* * Generates data (string) for column specified by column ID for specified device. If sortdata * is not NULL then returns number usable to sort the column if the data are available for the @@ -1033,18 +1051,7 @@ static char *device_get_data( } break; case COL_DMAX: - if (lsblk->bytes) { - ul_path_read_string(dev->sysfs, &str, "queue/discard_max_bytes"); - if (sortdata) - str2u64(str, sortdata); - } else { - uint64_t x; - if (ul_path_read_u64(dev->sysfs, &x, "queue/discard_max_bytes") == 0) { - str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); - if (sortdata) - *sortdata = x; - } - } + device_read_bytes(dev, "queue/discard_max_bytes", &str, sortdata); break; case COL_DZERO: if (device_get_discard_granularity(dev) > 0) @@ -1053,19 +1060,7 @@ static char *device_get_data( str = xstrdup("0"); break; case COL_WSAME: - if (lsblk->bytes) { - ul_path_read_string(dev->sysfs, &str, "queue/write_same_max_bytes"); - if (sortdata) - str2u64(str, sortdata); - } else { - uint64_t x; - - if (ul_path_read_u64(dev->sysfs, &x, "queue/write_same_max_bytes") == 0) { - str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); - if (sortdata) - *sortdata = x; - } - } + device_read_bytes(dev, "queue/write_same_max_bytes", &str, sortdata); if (!str) str = xstrdup("0"); break; -- 2.33.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes 2021-08-27 7:34 ` [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes Naohiro Aota @ 2021-08-29 23:07 ` Damien Le Moal 2021-08-30 1:21 ` Naohiro Aota 0 siblings, 1 reply; 12+ messages in thread From: Damien Le Moal @ 2021-08-29 23:07 UTC (permalink / raw) To: Naohiro Aota, Karel Zak; +Cc: util-linux On 2021/08/27 16:35, Naohiro Aota wrote: > Factor out a new function device_read_bytes() to read a sysfs path as bytes > for a preparation for the next commit and to reduce the code duplication. > > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > --- > misc-utils/lsblk.c | 45 ++++++++++++++++++++------------------------- > 1 file changed, 20 insertions(+), 25 deletions(-) > > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > index 100eba0779f8..775a6d832076 100644 > --- a/misc-utils/lsblk.c > +++ b/misc-utils/lsblk.c > @@ -708,6 +708,24 @@ static uint64_t device_get_discard_granularity(struct lsblk_device *dev) > return dev->discard_granularity; > } > > +static void device_read_bytes(struct lsblk_device *dev, char *path, char **str, > + uint64_t *sortdata) > +{ > + if (lsblk->bytes) { > + ul_path_read_string(dev->sysfs, str, path); > + if (sortdata) > + str2u64(*str, sortdata); You could return early here to avoid the else... > + } else { > + uint64_t x; > + > + if (ul_path_read_u64(dev->sysfs, &x, path) == 0) { > + *str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > + if (sortdata) > + *sortdata = x; > + } > + } > +} > + > /* > * Generates data (string) for column specified by column ID for specified device. If sortdata > * is not NULL then returns number usable to sort the column if the data are available for the > @@ -1033,18 +1051,7 @@ static char *device_get_data( > } > break; > case COL_DMAX: > - if (lsblk->bytes) { > - ul_path_read_string(dev->sysfs, &str, "queue/discard_max_bytes"); > - if (sortdata) > - str2u64(str, sortdata); > - } else { > - uint64_t x; > - if (ul_path_read_u64(dev->sysfs, &x, "queue/discard_max_bytes") == 0) { > - str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > - if (sortdata) > - *sortdata = x; > - } > - } > + device_read_bytes(dev, "queue/discard_max_bytes", &str, sortdata); > break; > case COL_DZERO: > if (device_get_discard_granularity(dev) > 0) > @@ -1053,19 +1060,7 @@ static char *device_get_data( > str = xstrdup("0"); > break; > case COL_WSAME: > - if (lsblk->bytes) { > - ul_path_read_string(dev->sysfs, &str, "queue/write_same_max_bytes"); > - if (sortdata) > - str2u64(str, sortdata); > - } else { > - uint64_t x; > - > - if (ul_path_read_u64(dev->sysfs, &x, "queue/write_same_max_bytes") == 0) { > - str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > - if (sortdata) > - *sortdata = x; > - } > - } > + device_read_bytes(dev, "queue/write_same_max_bytes", &str, sortdata); > if (!str) > str = xstrdup("0"); > break; > Apart from the optional nit above, looks good to me. Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes 2021-08-29 23:07 ` Damien Le Moal @ 2021-08-30 1:21 ` Naohiro Aota 0 siblings, 0 replies; 12+ messages in thread From: Naohiro Aota @ 2021-08-30 1:21 UTC (permalink / raw) To: Damien Le Moal; +Cc: Karel Zak, util-linux On Sun, Aug 29, 2021 at 11:07:10PM +0000, Damien Le Moal wrote: > On 2021/08/27 16:35, Naohiro Aota wrote: > > Factor out a new function device_read_bytes() to read a sysfs path as bytes > > for a preparation for the next commit and to reduce the code duplication. > > > > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > > --- > > misc-utils/lsblk.c | 45 ++++++++++++++++++++------------------------- > > 1 file changed, 20 insertions(+), 25 deletions(-) > > > > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > > index 100eba0779f8..775a6d832076 100644 > > --- a/misc-utils/lsblk.c > > +++ b/misc-utils/lsblk.c > > @@ -708,6 +708,24 @@ static uint64_t device_get_discard_granularity(struct lsblk_device *dev) > > return dev->discard_granularity; > > } > > > > +static void device_read_bytes(struct lsblk_device *dev, char *path, char **str, > > + uint64_t *sortdata) > > +{ > > + if (lsblk->bytes) { > > + ul_path_read_string(dev->sysfs, str, path); > > + if (sortdata) > > + str2u64(*str, sortdata); > > You could return early here to avoid the else... Yes, that will be more simple. I'll send a new series with the fix to the "max" description. > > + } else { > > + uint64_t x; > > + > > + if (ul_path_read_u64(dev->sysfs, &x, path) == 0) { > > + *str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > > + if (sortdata) > > + *sortdata = x; > > + } > > + } > > +} > > + > > /* > > * Generates data (string) for column specified by column ID for specified device. If sortdata > > * is not NULL then returns number usable to sort the column if the data are available for the > > @@ -1033,18 +1051,7 @@ static char *device_get_data( > > } > > break; > > case COL_DMAX: > > - if (lsblk->bytes) { > > - ul_path_read_string(dev->sysfs, &str, "queue/discard_max_bytes"); > > - if (sortdata) > > - str2u64(str, sortdata); > > - } else { > > - uint64_t x; > > - if (ul_path_read_u64(dev->sysfs, &x, "queue/discard_max_bytes") == 0) { > > - str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > > - if (sortdata) > > - *sortdata = x; > > - } > > - } > > + device_read_bytes(dev, "queue/discard_max_bytes", &str, sortdata); > > break; > > case COL_DZERO: > > if (device_get_discard_granularity(dev) > 0) > > @@ -1053,19 +1060,7 @@ static char *device_get_data( > > str = xstrdup("0"); > > break; > > case COL_WSAME: > > - if (lsblk->bytes) { > > - ul_path_read_string(dev->sysfs, &str, "queue/write_same_max_bytes"); > > - if (sortdata) > > - str2u64(str, sortdata); > > - } else { > > - uint64_t x; > > - > > - if (ul_path_read_u64(dev->sysfs, &x, "queue/write_same_max_bytes") == 0) { > > - str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > > - if (sortdata) > > - *sortdata = x; > > - } > > - } > > + device_read_bytes(dev, "queue/write_same_max_bytes", &str, sortdata); > > if (!str) > > str = xstrdup("0"); > > break; > > > > Apart from the optional nit above, looks good to me. > > Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> > > > -- > Damien Le Moal > Western Digital Research > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/3] lsblk: add columns of zoned parameters 2021-08-27 7:34 [PATCH v2 0/3] add columns for zoned parameters Naohiro Aota 2021-08-27 7:34 ` [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes Naohiro Aota @ 2021-08-27 7:34 ` Naohiro Aota 2021-08-29 23:10 ` Damien Le Moal 2021-08-29 23:15 ` Damien Le Moal 2021-08-27 7:34 ` [PATCH v2 3/3] lsblk: add zoned columns to "lsblk -z" Naohiro Aota 2 siblings, 2 replies; 12+ messages in thread From: Naohiro Aota @ 2021-08-27 7:34 UTC (permalink / raw) To: Karel Zak; +Cc: util-linux, Damien.LeMoal, Naohiro Aota Several parameters for zoned devices are missing from lsblk's columns. This commit introduces them as following. ZONE-SZ zone size ZONE-GRAN zone write granularity ZONE-APP zone append max bytes ZONE-NR number of zones ZONE-OMAX max open zones ZONE-AMAX max active zones Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> --- bash-completion/lsblk | 3 ++- misc-utils/lsblk.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/bash-completion/lsblk b/bash-completion/lsblk index 731ef3f4095d..c9ebbdcedef6 100644 --- a/bash-completion/lsblk +++ b/bash-completion/lsblk @@ -10,7 +10,8 @@ _lsblk_module() LABEL UUID PTUUID PTTYPE PARTTYPE PARTTYPENAME PARTLABEL PARTUUID PARTFLAGS RA RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO - WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED DAX + WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED ZONE-SZ ZONE-GRAN + ZONE-APP ZONE-NR ZONE-OMAX ZONE-AMAX DAX " case $prev in diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 775a6d832076..108c8187498e 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -123,6 +123,12 @@ enum { COL_WSAME, COL_WWN, COL_ZONED, + COL_ZONESIZE, + COL_ZONEWRITEGRAN, + COL_ZONEAPPEND, + COL_ZONE_NR, + COL_ZONE_OMAX, + COL_ZONE_AMAX, }; /* basic table settings */ @@ -213,6 +219,12 @@ static struct colinfo infos[] = { [COL_WSAME] = { "WSAME", 6, SCOLS_FL_RIGHT, N_("write same max bytes"), COLTYPE_SIZE }, [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier") }, [COL_ZONED] = { "ZONED", 0.3, 0, N_("zone model") }, + [COL_ZONESIZE] = { "ZONE-SZ", 9, SCOLS_FL_RIGHT, N_("zone size"), COLTYPE_NUM }, + [COL_ZONEWRITEGRAN] = { "ZONE-GRAN", 10, SCOLS_FL_RIGHT, N_("zone write granularity"), COLTYPE_NUM }, + [COL_ZONEAPPEND] = { "ZONE-APP", 11, SCOLS_FL_RIGHT, N_("zone append max bytes"), COLTYPE_NUM }, + [COL_ZONE_NR] = { "ZONE-NR", 8, SCOLS_FL_RIGHT, N_("number of zones"), COLTYPE_NUM }, + [COL_ZONE_OMAX] = { "ZONE-OMAX", 10, SCOLS_FL_RIGHT, N_("max open zones"), COLTYPE_NUM }, + [COL_ZONE_AMAX] = { "ZONE-AMAX", 10, SCOLS_FL_RIGHT, N_("max active zones"), COLTYPE_NUM }, }; struct lsblk *lsblk; /* global handler */ @@ -1067,6 +1079,46 @@ static char *device_get_data( case COL_ZONED: ul_path_read_string(dev->sysfs, &str, "queue/zoned"); break; + case COL_ZONESIZE: + { + uint64_t x; + + if (ul_path_read_u64(dev->sysfs, &x, "queue/chunk_sectors") == 0) { + x <<= 9; + if (lsblk->bytes) + xasprintf(&str, "%ju", x); + else + str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); + if (sortdata) + *sortdata = x; + } + break; + } + case COL_ZONEWRITEGRAN: + device_read_bytes(dev, "queue/zone_write_granularity", &str, sortdata); + break; + case COL_ZONEAPPEND: + device_read_bytes(dev, "queue/zone_append_max_bytes", &str, sortdata); + break; + case COL_ZONE_NR: + ul_path_read_string(dev->sysfs, &str, "queue/nr_zones"); + if (sortdata) + str2u64(str, sortdata); + break; + case COL_ZONE_OMAX: + ul_path_read_string(dev->sysfs, &str, "queue/max_open_zones"); + if (!str) + str = xstrdup("0"); + if (sortdata) + str2u64(str, sortdata); + break; + case COL_ZONE_AMAX: + ul_path_read_string(dev->sysfs, &str, "queue/max_active_zones"); + if (!str) + str = xstrdup("0"); + if (sortdata) + str2u64(str, sortdata); + break; case COL_DAX: ul_path_read_string(dev->sysfs, &str, "queue/dax"); break; -- 2.33.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] lsblk: add columns of zoned parameters 2021-08-27 7:34 ` [PATCH v2 2/3] lsblk: add columns of zoned parameters Naohiro Aota @ 2021-08-29 23:10 ` Damien Le Moal 2021-08-30 1:08 ` Naohiro Aota 2021-08-29 23:15 ` Damien Le Moal 1 sibling, 1 reply; 12+ messages in thread From: Damien Le Moal @ 2021-08-29 23:10 UTC (permalink / raw) To: Naohiro Aota, Karel Zak; +Cc: util-linux On 2021/08/27 16:35, Naohiro Aota wrote: > Several parameters for zoned devices are missing from lsblk's columns. This > commit introduces them as following. > > ZONE-SZ zone size > ZONE-GRAN zone write granularity ZONE-WGRAN ? (to enforce the point that is a WRITE granularity). > ZONE-APP zone append max bytes > ZONE-NR number of zones > ZONE-OMAX max open zones > ZONE-AMAX max active zones > > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > --- > bash-completion/lsblk | 3 ++- > misc-utils/lsblk.c | 52 +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 54 insertions(+), 1 deletion(-) > > diff --git a/bash-completion/lsblk b/bash-completion/lsblk > index 731ef3f4095d..c9ebbdcedef6 100644 > --- a/bash-completion/lsblk > +++ b/bash-completion/lsblk > @@ -10,7 +10,8 @@ _lsblk_module() > LABEL UUID PTUUID PTTYPE PARTTYPE PARTTYPENAME PARTLABEL PARTUUID PARTFLAGS RA > RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO > PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO > - WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED DAX > + WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED ZONE-SZ ZONE-GRAN > + ZONE-APP ZONE-NR ZONE-OMAX ZONE-AMAX DAX > " > > case $prev in > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > index 775a6d832076..108c8187498e 100644 > --- a/misc-utils/lsblk.c > +++ b/misc-utils/lsblk.c > @@ -123,6 +123,12 @@ enum { > COL_WSAME, > COL_WWN, > COL_ZONED, > + COL_ZONESIZE, > + COL_ZONEWRITEGRAN, > + COL_ZONEAPPEND, COL_ZONESZ COL_ZONEWGRAN COL_ZONEAPP To be inline with the columns display names ? > + COL_ZONE_NR, > + COL_ZONE_OMAX, > + COL_ZONE_AMAX, > }; > > /* basic table settings */ > @@ -213,6 +219,12 @@ static struct colinfo infos[] = { > [COL_WSAME] = { "WSAME", 6, SCOLS_FL_RIGHT, N_("write same max bytes"), COLTYPE_SIZE }, > [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier") }, > [COL_ZONED] = { "ZONED", 0.3, 0, N_("zone model") }, > + [COL_ZONESIZE] = { "ZONE-SZ", 9, SCOLS_FL_RIGHT, N_("zone size"), COLTYPE_NUM }, > + [COL_ZONEWRITEGRAN] = { "ZONE-GRAN", 10, SCOLS_FL_RIGHT, N_("zone write granularity"), COLTYPE_NUM }, > + [COL_ZONEAPPEND] = { "ZONE-APP", 11, SCOLS_FL_RIGHT, N_("zone append max bytes"), COLTYPE_NUM }, > + [COL_ZONE_NR] = { "ZONE-NR", 8, SCOLS_FL_RIGHT, N_("number of zones"), COLTYPE_NUM }, > + [COL_ZONE_OMAX] = { "ZONE-OMAX", 10, SCOLS_FL_RIGHT, N_("max open zones"), COLTYPE_NUM }, > + [COL_ZONE_AMAX] = { "ZONE-AMAX", 10, SCOLS_FL_RIGHT, N_("max active zones"), COLTYPE_NUM }, > }; > > struct lsblk *lsblk; /* global handler */ > @@ -1067,6 +1079,46 @@ static char *device_get_data( > case COL_ZONED: > ul_path_read_string(dev->sysfs, &str, "queue/zoned"); > break; > + case COL_ZONESIZE: > + { > + uint64_t x; > + > + if (ul_path_read_u64(dev->sysfs, &x, "queue/chunk_sectors") == 0) { > + x <<= 9; > + if (lsblk->bytes) > + xasprintf(&str, "%ju", x); > + else > + str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > + if (sortdata) > + *sortdata = x; > + } > + break; > + } > + case COL_ZONEWRITEGRAN: > + device_read_bytes(dev, "queue/zone_write_granularity", &str, sortdata); > + break; > + case COL_ZONEAPPEND: > + device_read_bytes(dev, "queue/zone_append_max_bytes", &str, sortdata); > + break; > + case COL_ZONE_NR: > + ul_path_read_string(dev->sysfs, &str, "queue/nr_zones"); > + if (sortdata) > + str2u64(str, sortdata); > + break; > + case COL_ZONE_OMAX: > + ul_path_read_string(dev->sysfs, &str, "queue/max_open_zones"); > + if (!str) > + str = xstrdup("0"); > + if (sortdata) > + str2u64(str, sortdata); > + break; > + case COL_ZONE_AMAX: > + ul_path_read_string(dev->sysfs, &str, "queue/max_active_zones"); > + if (!str) > + str = xstrdup("0"); > + if (sortdata) > + str2u64(str, sortdata); > + break; > case COL_DAX: > ul_path_read_string(dev->sysfs, &str, "queue/dax"); > break; > -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] lsblk: add columns of zoned parameters 2021-08-29 23:10 ` Damien Le Moal @ 2021-08-30 1:08 ` Naohiro Aota 2021-08-30 1:50 ` Damien Le Moal 0 siblings, 1 reply; 12+ messages in thread From: Naohiro Aota @ 2021-08-30 1:08 UTC (permalink / raw) To: Damien Le Moal; +Cc: Karel Zak, util-linux On Sun, Aug 29, 2021 at 11:10:18PM +0000, Damien Le Moal wrote: > On 2021/08/27 16:35, Naohiro Aota wrote: > > Several parameters for zoned devices are missing from lsblk's columns. This > > commit introduces them as following. > > > > ZONE-SZ zone size > > ZONE-GRAN zone write granularity > > ZONE-WGRAN ? (to enforce the point that is a WRITE granularity). I changed WGRAN to GRAN to follow DISC-GRAN (discard granularity) and to have a shorter name. But, either is fine for me. > > > ZONE-APP zone append max bytes > > ZONE-NR number of zones > > ZONE-OMAX max open zones > > ZONE-AMAX max active zones > > > > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > > --- > > bash-completion/lsblk | 3 ++- > > misc-utils/lsblk.c | 52 +++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 54 insertions(+), 1 deletion(-) > > > > diff --git a/bash-completion/lsblk b/bash-completion/lsblk > > index 731ef3f4095d..c9ebbdcedef6 100644 > > --- a/bash-completion/lsblk > > +++ b/bash-completion/lsblk > > @@ -10,7 +10,8 @@ _lsblk_module() > > LABEL UUID PTUUID PTTYPE PARTTYPE PARTTYPENAME PARTLABEL PARTUUID PARTFLAGS RA > > RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO > > PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO > > - WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED DAX > > + WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED ZONE-SZ ZONE-GRAN > > + ZONE-APP ZONE-NR ZONE-OMAX ZONE-AMAX DAX > > " > > > > case $prev in > > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > > index 775a6d832076..108c8187498e 100644 > > --- a/misc-utils/lsblk.c > > +++ b/misc-utils/lsblk.c > > @@ -123,6 +123,12 @@ enum { > > COL_WSAME, > > COL_WWN, > > COL_ZONED, > > + COL_ZONESIZE, > > + COL_ZONEWRITEGRAN, > > + COL_ZONEAPPEND, > > COL_ZONESZ > COL_ZONEWGRAN > COL_ZONEAPP > > To be inline with the columns display names ? Sure. I'll fix. > > + COL_ZONE_NR, > > + COL_ZONE_OMAX, > > + COL_ZONE_AMAX, > > }; > > /* basic table settings */ > > @@ -213,6 +219,12 @@ static struct colinfo infos[] = { > > [COL_WSAME] = { "WSAME", 6, SCOLS_FL_RIGHT, N_("write same max bytes"), COLTYPE_SIZE }, > > [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier") }, > > [COL_ZONED] = { "ZONED", 0.3, 0, N_("zone model") }, > > + [COL_ZONESIZE] = { "ZONE-SZ", 9, SCOLS_FL_RIGHT, N_("zone size"), COLTYPE_NUM }, > > + [COL_ZONEWRITEGRAN] = { "ZONE-GRAN", 10, SCOLS_FL_RIGHT, N_("zone write granularity"), COLTYPE_NUM }, > > + [COL_ZONEAPPEND] = { "ZONE-APP", 11, SCOLS_FL_RIGHT, N_("zone append max bytes"), COLTYPE_NUM }, > > + [COL_ZONE_NR] = { "ZONE-NR", 8, SCOLS_FL_RIGHT, N_("number of zones"), COLTYPE_NUM }, > > + [COL_ZONE_OMAX] = { "ZONE-OMAX", 10, SCOLS_FL_RIGHT, N_("max open zones"), COLTYPE_NUM }, > > + [COL_ZONE_AMAX] = { "ZONE-AMAX", 10, SCOLS_FL_RIGHT, N_("max active zones"), COLTYPE_NUM }, > > }; > > > > struct lsblk *lsblk; /* global handler */ > > @@ -1067,6 +1079,46 @@ static char *device_get_data( > > case COL_ZONED: > > ul_path_read_string(dev->sysfs, &str, "queue/zoned"); > > break; > > + case COL_ZONESIZE: > > + { > > + uint64_t x; > > + > > + if (ul_path_read_u64(dev->sysfs, &x, "queue/chunk_sectors") == 0) { > > + x <<= 9; > > + if (lsblk->bytes) > > + xasprintf(&str, "%ju", x); > > + else > > + str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > > + if (sortdata) > > + *sortdata = x; > > + } > > + break; > > + } > > + case COL_ZONEWRITEGRAN: > > + device_read_bytes(dev, "queue/zone_write_granularity", &str, sortdata); > > + break; > > + case COL_ZONEAPPEND: > > + device_read_bytes(dev, "queue/zone_append_max_bytes", &str, sortdata); > > + break; > > + case COL_ZONE_NR: > > + ul_path_read_string(dev->sysfs, &str, "queue/nr_zones"); > > + if (sortdata) > > + str2u64(str, sortdata); > > + break; > > + case COL_ZONE_OMAX: > > + ul_path_read_string(dev->sysfs, &str, "queue/max_open_zones"); > > + if (!str) > > + str = xstrdup("0"); > > + if (sortdata) > > + str2u64(str, sortdata); > > + break; > > + case COL_ZONE_AMAX: > > + ul_path_read_string(dev->sysfs, &str, "queue/max_active_zones"); > > + if (!str) > > + str = xstrdup("0"); > > + if (sortdata) > > + str2u64(str, sortdata); > > + break; > > case COL_DAX: > > ul_path_read_string(dev->sysfs, &str, "queue/dax"); > > break; > > > > > -- > Damien Le Moal > Western Digital Research > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] lsblk: add columns of zoned parameters 2021-08-30 1:08 ` Naohiro Aota @ 2021-08-30 1:50 ` Damien Le Moal 2021-08-30 5:15 ` Naohiro Aota 0 siblings, 1 reply; 12+ messages in thread From: Damien Le Moal @ 2021-08-30 1:50 UTC (permalink / raw) To: Naohiro Aota; +Cc: Karel Zak, util-linux On 2021/08/30 10:08, Naohiro Aota wrote: > On Sun, Aug 29, 2021 at 11:10:18PM +0000, Damien Le Moal wrote: >> On 2021/08/27 16:35, Naohiro Aota wrote: >>> Several parameters for zoned devices are missing from lsblk's columns. This >>> commit introduces them as following. >>> >>> ZONE-SZ zone size >>> ZONE-GRAN zone write granularity >> >> ZONE-WGRAN ? (to enforce the point that is a WRITE granularity). > > I changed WGRAN to GRAN to follow DISC-GRAN (discard granularity) and > to have a shorter name. But, either is fine for me. "DISC" in "DISC-GRAN" qualifies the granularity: it is clear that it is for discard. With ZONE-GRAN, you do not get the qualifier since zone granularity does not mean anything. I really think ZONE-WGRAN or ZONE-WRGRAN would be clearer. > >> >>> ZONE-APP zone append max bytes >>> ZONE-NR number of zones >>> ZONE-OMAX max open zones >>> ZONE-AMAX max active zones >>> >>> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> >>> --- >>> bash-completion/lsblk | 3 ++- >>> misc-utils/lsblk.c | 52 +++++++++++++++++++++++++++++++++++++++++++ >>> 2 files changed, 54 insertions(+), 1 deletion(-) >>> >>> diff --git a/bash-completion/lsblk b/bash-completion/lsblk >>> index 731ef3f4095d..c9ebbdcedef6 100644 >>> --- a/bash-completion/lsblk >>> +++ b/bash-completion/lsblk >>> @@ -10,7 +10,8 @@ _lsblk_module() >>> LABEL UUID PTUUID PTTYPE PARTTYPE PARTTYPENAME PARTLABEL PARTUUID PARTFLAGS RA >>> RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO >>> PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO >>> - WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED DAX >>> + WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED ZONE-SZ ZONE-GRAN >>> + ZONE-APP ZONE-NR ZONE-OMAX ZONE-AMAX DAX >>> " >>> >>> case $prev in >>> diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c >>> index 775a6d832076..108c8187498e 100644 >>> --- a/misc-utils/lsblk.c >>> +++ b/misc-utils/lsblk.c >>> @@ -123,6 +123,12 @@ enum { >>> COL_WSAME, >>> COL_WWN, >>> COL_ZONED, >>> + COL_ZONESIZE, >>> + COL_ZONEWRITEGRAN, >>> + COL_ZONEAPPEND, >> >> COL_ZONESZ >> COL_ZONEWGRAN >> COL_ZONEAPP >> >> To be inline with the columns display names ? > > Sure. I'll fix. > >>> + COL_ZONE_NR, >>> + COL_ZONE_OMAX, >>> + COL_ZONE_AMAX, >>> }; >>> /* basic table settings */ >>> @@ -213,6 +219,12 @@ static struct colinfo infos[] = { >>> [COL_WSAME] = { "WSAME", 6, SCOLS_FL_RIGHT, N_("write same max bytes"), COLTYPE_SIZE }, >>> [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier") }, >>> [COL_ZONED] = { "ZONED", 0.3, 0, N_("zone model") }, >>> + [COL_ZONESIZE] = { "ZONE-SZ", 9, SCOLS_FL_RIGHT, N_("zone size"), COLTYPE_NUM }, >>> + [COL_ZONEWRITEGRAN] = { "ZONE-GRAN", 10, SCOLS_FL_RIGHT, N_("zone write granularity"), COLTYPE_NUM }, >>> + [COL_ZONEAPPEND] = { "ZONE-APP", 11, SCOLS_FL_RIGHT, N_("zone append max bytes"), COLTYPE_NUM }, >>> + [COL_ZONE_NR] = { "ZONE-NR", 8, SCOLS_FL_RIGHT, N_("number of zones"), COLTYPE_NUM }, >>> + [COL_ZONE_OMAX] = { "ZONE-OMAX", 10, SCOLS_FL_RIGHT, N_("max open zones"), COLTYPE_NUM }, >>> + [COL_ZONE_AMAX] = { "ZONE-AMAX", 10, SCOLS_FL_RIGHT, N_("max active zones"), COLTYPE_NUM }, >>> }; >>> >>> struct lsblk *lsblk; /* global handler */ >>> @@ -1067,6 +1079,46 @@ static char *device_get_data( >>> case COL_ZONED: >>> ul_path_read_string(dev->sysfs, &str, "queue/zoned"); >>> break; >>> + case COL_ZONESIZE: >>> + { >>> + uint64_t x; >>> + >>> + if (ul_path_read_u64(dev->sysfs, &x, "queue/chunk_sectors") == 0) { >>> + x <<= 9; >>> + if (lsblk->bytes) >>> + xasprintf(&str, "%ju", x); >>> + else >>> + str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); >>> + if (sortdata) >>> + *sortdata = x; >>> + } >>> + break; >>> + } >>> + case COL_ZONEWRITEGRAN: >>> + device_read_bytes(dev, "queue/zone_write_granularity", &str, sortdata); >>> + break; >>> + case COL_ZONEAPPEND: >>> + device_read_bytes(dev, "queue/zone_append_max_bytes", &str, sortdata); >>> + break; >>> + case COL_ZONE_NR: >>> + ul_path_read_string(dev->sysfs, &str, "queue/nr_zones"); >>> + if (sortdata) >>> + str2u64(str, sortdata); >>> + break; >>> + case COL_ZONE_OMAX: >>> + ul_path_read_string(dev->sysfs, &str, "queue/max_open_zones"); >>> + if (!str) >>> + str = xstrdup("0"); >>> + if (sortdata) >>> + str2u64(str, sortdata); >>> + break; >>> + case COL_ZONE_AMAX: >>> + ul_path_read_string(dev->sysfs, &str, "queue/max_active_zones"); >>> + if (!str) >>> + str = xstrdup("0"); >>> + if (sortdata) >>> + str2u64(str, sortdata); >>> + break; >>> case COL_DAX: >>> ul_path_read_string(dev->sysfs, &str, "queue/dax"); >>> break; >>> >> >> >> -- >> Damien Le Moal >> Western Digital Research >> -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] lsblk: add columns of zoned parameters 2021-08-30 1:50 ` Damien Le Moal @ 2021-08-30 5:15 ` Naohiro Aota 0 siblings, 0 replies; 12+ messages in thread From: Naohiro Aota @ 2021-08-30 5:15 UTC (permalink / raw) To: Damien Le Moal; +Cc: Karel Zak, util-linux On Mon, Aug 30, 2021 at 01:50:58AM +0000, Damien Le Moal wrote: > On 2021/08/30 10:08, Naohiro Aota wrote: > > On Sun, Aug 29, 2021 at 11:10:18PM +0000, Damien Le Moal wrote: > >> On 2021/08/27 16:35, Naohiro Aota wrote: > >>> Several parameters for zoned devices are missing from lsblk's columns. This > >>> commit introduces them as following. > >>> > >>> ZONE-SZ zone size > >>> ZONE-GRAN zone write granularity > >> > >> ZONE-WGRAN ? (to enforce the point that is a WRITE granularity). > > > > I changed WGRAN to GRAN to follow DISC-GRAN (discard granularity) and > > to have a shorter name. But, either is fine for me. > > "DISC" in "DISC-GRAN" qualifies the granularity: it is clear that it is for > discard. With ZONE-GRAN, you do not get the qualifier since zone granularity > does not mean anything. I really think ZONE-WGRAN or ZONE-WRGRAN would be clearer. Make sense. I'll use ZONE-WGRAN in the next series. > > > >> > >>> ZONE-APP zone append max bytes > >>> ZONE-NR number of zones > >>> ZONE-OMAX max open zones > >>> ZONE-AMAX max active zones > >>> > >>> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > >>> --- > >>> bash-completion/lsblk | 3 ++- > >>> misc-utils/lsblk.c | 52 +++++++++++++++++++++++++++++++++++++++++++ > >>> 2 files changed, 54 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/bash-completion/lsblk b/bash-completion/lsblk > >>> index 731ef3f4095d..c9ebbdcedef6 100644 > >>> --- a/bash-completion/lsblk > >>> +++ b/bash-completion/lsblk > >>> @@ -10,7 +10,8 @@ _lsblk_module() > >>> LABEL UUID PTUUID PTTYPE PARTTYPE PARTTYPENAME PARTLABEL PARTUUID PARTFLAGS RA > >>> RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO > >>> PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO > >>> - WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED DAX > >>> + WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED ZONE-SZ ZONE-GRAN > >>> + ZONE-APP ZONE-NR ZONE-OMAX ZONE-AMAX DAX > >>> " > >>> > >>> case $prev in > >>> diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > >>> index 775a6d832076..108c8187498e 100644 > >>> --- a/misc-utils/lsblk.c > >>> +++ b/misc-utils/lsblk.c > >>> @@ -123,6 +123,12 @@ enum { > >>> COL_WSAME, > >>> COL_WWN, > >>> COL_ZONED, > >>> + COL_ZONESIZE, > >>> + COL_ZONEWRITEGRAN, > >>> + COL_ZONEAPPEND, > >> > >> COL_ZONESZ > >> COL_ZONEWGRAN > >> COL_ZONEAPP > >> > >> To be inline with the columns display names ? > > > > Sure. I'll fix. > > > >>> + COL_ZONE_NR, > >>> + COL_ZONE_OMAX, > >>> + COL_ZONE_AMAX, > >>> }; > >>> /* basic table settings */ > >>> @@ -213,6 +219,12 @@ static struct colinfo infos[] = { > >>> [COL_WSAME] = { "WSAME", 6, SCOLS_FL_RIGHT, N_("write same max bytes"), COLTYPE_SIZE }, > >>> [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier") }, > >>> [COL_ZONED] = { "ZONED", 0.3, 0, N_("zone model") }, > >>> + [COL_ZONESIZE] = { "ZONE-SZ", 9, SCOLS_FL_RIGHT, N_("zone size"), COLTYPE_NUM }, > >>> + [COL_ZONEWRITEGRAN] = { "ZONE-GRAN", 10, SCOLS_FL_RIGHT, N_("zone write granularity"), COLTYPE_NUM }, > >>> + [COL_ZONEAPPEND] = { "ZONE-APP", 11, SCOLS_FL_RIGHT, N_("zone append max bytes"), COLTYPE_NUM }, > >>> + [COL_ZONE_NR] = { "ZONE-NR", 8, SCOLS_FL_RIGHT, N_("number of zones"), COLTYPE_NUM }, > >>> + [COL_ZONE_OMAX] = { "ZONE-OMAX", 10, SCOLS_FL_RIGHT, N_("max open zones"), COLTYPE_NUM }, > >>> + [COL_ZONE_AMAX] = { "ZONE-AMAX", 10, SCOLS_FL_RIGHT, N_("max active zones"), COLTYPE_NUM }, > >>> }; > >>> > >>> struct lsblk *lsblk; /* global handler */ > >>> @@ -1067,6 +1079,46 @@ static char *device_get_data( > >>> case COL_ZONED: > >>> ul_path_read_string(dev->sysfs, &str, "queue/zoned"); > >>> break; > >>> + case COL_ZONESIZE: > >>> + { > >>> + uint64_t x; > >>> + > >>> + if (ul_path_read_u64(dev->sysfs, &x, "queue/chunk_sectors") == 0) { > >>> + x <<= 9; > >>> + if (lsblk->bytes) > >>> + xasprintf(&str, "%ju", x); > >>> + else > >>> + str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > >>> + if (sortdata) > >>> + *sortdata = x; > >>> + } > >>> + break; > >>> + } > >>> + case COL_ZONEWRITEGRAN: > >>> + device_read_bytes(dev, "queue/zone_write_granularity", &str, sortdata); > >>> + break; > >>> + case COL_ZONEAPPEND: > >>> + device_read_bytes(dev, "queue/zone_append_max_bytes", &str, sortdata); > >>> + break; > >>> + case COL_ZONE_NR: > >>> + ul_path_read_string(dev->sysfs, &str, "queue/nr_zones"); > >>> + if (sortdata) > >>> + str2u64(str, sortdata); > >>> + break; > >>> + case COL_ZONE_OMAX: > >>> + ul_path_read_string(dev->sysfs, &str, "queue/max_open_zones"); > >>> + if (!str) > >>> + str = xstrdup("0"); > >>> + if (sortdata) > >>> + str2u64(str, sortdata); > >>> + break; > >>> + case COL_ZONE_AMAX: > >>> + ul_path_read_string(dev->sysfs, &str, "queue/max_active_zones"); > >>> + if (!str) > >>> + str = xstrdup("0"); > >>> + if (sortdata) > >>> + str2u64(str, sortdata); > >>> + break; > >>> case COL_DAX: > >>> ul_path_read_string(dev->sysfs, &str, "queue/dax"); > >>> break; > >>> > >> > >> > >> -- > >> Damien Le Moal > >> Western Digital Research > >> > > > -- > Damien Le Moal > Western Digital Research > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] lsblk: add columns of zoned parameters 2021-08-27 7:34 ` [PATCH v2 2/3] lsblk: add columns of zoned parameters Naohiro Aota 2021-08-29 23:10 ` Damien Le Moal @ 2021-08-29 23:15 ` Damien Le Moal 1 sibling, 0 replies; 12+ messages in thread From: Damien Le Moal @ 2021-08-29 23:15 UTC (permalink / raw) To: Naohiro Aota, Karel Zak; +Cc: util-linux On 2021/08/27 16:35, Naohiro Aota wrote: > Several parameters for zoned devices are missing from lsblk's columns. This > commit introduces them as following. > > ZONE-SZ zone size > ZONE-GRAN zone write granularity > ZONE-APP zone append max bytes > ZONE-NR number of zones > ZONE-OMAX max open zones > ZONE-AMAX max active zones > > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > --- > bash-completion/lsblk | 3 ++- > misc-utils/lsblk.c | 52 +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 54 insertions(+), 1 deletion(-) > > diff --git a/bash-completion/lsblk b/bash-completion/lsblk > index 731ef3f4095d..c9ebbdcedef6 100644 > --- a/bash-completion/lsblk > +++ b/bash-completion/lsblk > @@ -10,7 +10,8 @@ _lsblk_module() > LABEL UUID PTUUID PTTYPE PARTTYPE PARTTYPENAME PARTLABEL PARTUUID PARTFLAGS RA > RO RM HOTPLUG MODEL SERIAL SIZE STATE OWNER GROUP MODE ALIGNMENT MIN-IO OPT-IO > PHY-SEC LOG-SEC ROTA SCHED RQ-SIZE TYPE DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO > - WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED DAX > + WSAME WWN RAND PKNAME HCTL TRAN SUBSYSTEMS REV VENDOR ZONED ZONE-SZ ZONE-GRAN > + ZONE-APP ZONE-NR ZONE-OMAX ZONE-AMAX DAX > " > > case $prev in > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > index 775a6d832076..108c8187498e 100644 > --- a/misc-utils/lsblk.c > +++ b/misc-utils/lsblk.c > @@ -123,6 +123,12 @@ enum { > COL_WSAME, > COL_WWN, > COL_ZONED, > + COL_ZONESIZE, > + COL_ZONEWRITEGRAN, > + COL_ZONEAPPEND, > + COL_ZONE_NR, > + COL_ZONE_OMAX, > + COL_ZONE_AMAX, > }; > > /* basic table settings */ > @@ -213,6 +219,12 @@ static struct colinfo infos[] = { > [COL_WSAME] = { "WSAME", 6, SCOLS_FL_RIGHT, N_("write same max bytes"), COLTYPE_SIZE }, > [COL_WWN] = { "WWN", 18, 0, N_("unique storage identifier") }, > [COL_ZONED] = { "ZONED", 0.3, 0, N_("zone model") }, > + [COL_ZONESIZE] = { "ZONE-SZ", 9, SCOLS_FL_RIGHT, N_("zone size"), COLTYPE_NUM }, > + [COL_ZONEWRITEGRAN] = { "ZONE-GRAN", 10, SCOLS_FL_RIGHT, N_("zone write granularity"), COLTYPE_NUM }, > + [COL_ZONEAPPEND] = { "ZONE-APP", 11, SCOLS_FL_RIGHT, N_("zone append max bytes"), COLTYPE_NUM }, > + [COL_ZONE_NR] = { "ZONE-NR", 8, SCOLS_FL_RIGHT, N_("number of zones"), COLTYPE_NUM }, > + [COL_ZONE_OMAX] = { "ZONE-OMAX", 10, SCOLS_FL_RIGHT, N_("max open zones"), COLTYPE_NUM }, "maximum number of open zones" for the description please. "max" is not a word and adding "number of" clarifies the unit of the value. > + [COL_ZONE_AMAX] = { "ZONE-AMAX", 10, SCOLS_FL_RIGHT, N_("max active zones"), COLTYPE_NUM }, Same here: "maximum number of active zones". > }; > > struct lsblk *lsblk; /* global handler */ > @@ -1067,6 +1079,46 @@ static char *device_get_data( > case COL_ZONED: > ul_path_read_string(dev->sysfs, &str, "queue/zoned"); > break; > + case COL_ZONESIZE: > + { > + uint64_t x; > + > + if (ul_path_read_u64(dev->sysfs, &x, "queue/chunk_sectors") == 0) { > + x <<= 9; > + if (lsblk->bytes) > + xasprintf(&str, "%ju", x); > + else > + str = size_to_human_string(SIZE_SUFFIX_1LETTER, x); > + if (sortdata) > + *sortdata = x; > + } > + break; > + } > + case COL_ZONEWRITEGRAN: > + device_read_bytes(dev, "queue/zone_write_granularity", &str, sortdata); > + break; > + case COL_ZONEAPPEND: > + device_read_bytes(dev, "queue/zone_append_max_bytes", &str, sortdata); > + break; > + case COL_ZONE_NR: > + ul_path_read_string(dev->sysfs, &str, "queue/nr_zones"); > + if (sortdata) > + str2u64(str, sortdata); > + break; > + case COL_ZONE_OMAX: > + ul_path_read_string(dev->sysfs, &str, "queue/max_open_zones"); > + if (!str) > + str = xstrdup("0"); > + if (sortdata) > + str2u64(str, sortdata); > + break; > + case COL_ZONE_AMAX: > + ul_path_read_string(dev->sysfs, &str, "queue/max_active_zones"); > + if (!str) > + str = xstrdup("0"); > + if (sortdata) > + str2u64(str, sortdata); > + break; > case COL_DAX: > ul_path_read_string(dev->sysfs, &str, "queue/dax"); > break; > -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 3/3] lsblk: add zoned columns to "lsblk -z" 2021-08-27 7:34 [PATCH v2 0/3] add columns for zoned parameters Naohiro Aota 2021-08-27 7:34 ` [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes Naohiro Aota 2021-08-27 7:34 ` [PATCH v2 2/3] lsblk: add columns of zoned parameters Naohiro Aota @ 2021-08-27 7:34 ` Naohiro Aota 2021-08-29 23:14 ` Damien Le Moal 2 siblings, 1 reply; 12+ messages in thread From: Naohiro Aota @ 2021-08-27 7:34 UTC (permalink / raw) To: Karel Zak; +Cc: util-linux, Damien.LeMoal, Naohiro Aota Add zoned columns to the "-z" option as follow. $ lsblk -z -i NAME ZONED ZONE-SZ ZONE-NR ZONE-AMAX ZONE-OMAX ZONE-APP ZONE-GRAN sda host-managed 256M 55880 0 128 672K 4K sdb host-managed 256M 55880 0 128 672K 4K zram0 none 0B 0 0 0 0B 0B nvme2n1 none 0B 0 0 0 0B 0B |-nvme2n1p1 none 0B 0 0 0 0B 0B |-nvme2n1p2 none 0B 0 0 0 0B 0B `-nvme2n1p3 none 0B 0 0 0 0B 0B nvme0n1 none 0B 0 0 0 0B 0B nvme1n1 none 0B 0 0 0 0B 0B nvme0n2 host-managed 2G 1844 14 14 4M 4K nvme1n2 host-managed 2G 1844 14 14 4M 4K Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> --- misc-utils/lsblk.8.adoc | 2 +- misc-utils/lsblk.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/misc-utils/lsblk.8.adoc b/misc-utils/lsblk.8.adoc index 7356976403a7..9e68a847ce0c 100644 --- a/misc-utils/lsblk.8.adoc +++ b/misc-utils/lsblk.8.adoc @@ -116,7 +116,7 @@ Specifies output width as a number of characters. The default is the number of t Sort output lines by _column_. This option enables *--list* output format by default. It is possible to use the option *--tree* to force tree-like output and than the tree branches are sorted by the _column_. *-z*, *--zoned*:: -Print the zone model for each device. +Print the zone related information for each device. *--sysroot* _directory_:: Gather data for a Linux instance other than the instance from which the *lsblk* command is issued. The specified directory is the system root of the Linux instance to be inspected. The real device nodes in the target directory can be replaced by text files with udev attributes. diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 108c8187498e..8a2578312f0d 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -1919,7 +1919,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" -t, --topology output info about topology\n"), out); fputs(_(" -w, --width <num> specifies output width as number of characters\n"), out); fputs(_(" -x, --sort <column> sort output by <column>\n"), out); - fputs(_(" -z, --zoned print zone model\n"), out); + fputs(_(" -z, --zoned print zone related information\n"), out); fputs(_(" --sysroot <dir> use specified directory as system root\n"), out); fputs(USAGE_SEPARATOR, out); printf(USAGE_HELP_OPTIONS(22)); @@ -2041,6 +2041,12 @@ int main(int argc, char *argv[]) case 'z': add_uniq_column(COL_NAME); add_uniq_column(COL_ZONED); + add_uniq_column(COL_ZONESIZE); + add_uniq_column(COL_ZONE_NR); + add_uniq_column(COL_ZONE_AMAX); + add_uniq_column(COL_ZONE_OMAX); + add_uniq_column(COL_ZONEAPPEND); + add_uniq_column(COL_ZONEWRITEGRAN); break; case 'e': parse_excludes(optarg); -- 2.33.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 3/3] lsblk: add zoned columns to "lsblk -z" 2021-08-27 7:34 ` [PATCH v2 3/3] lsblk: add zoned columns to "lsblk -z" Naohiro Aota @ 2021-08-29 23:14 ` Damien Le Moal 0 siblings, 0 replies; 12+ messages in thread From: Damien Le Moal @ 2021-08-29 23:14 UTC (permalink / raw) To: Naohiro Aota, Karel Zak; +Cc: util-linux On 2021/08/27 16:35, Naohiro Aota wrote: > Add zoned columns to the "-z" option as follow. > > $ lsblk -z -i > NAME ZONED ZONE-SZ ZONE-NR ZONE-AMAX ZONE-OMAX ZONE-APP ZONE-GRAN > sda host-managed 256M 55880 0 128 672K 4K > sdb host-managed 256M 55880 0 128 672K 4K > zram0 none 0B 0 0 0 0B 0B > nvme2n1 none 0B 0 0 0 0B 0B > |-nvme2n1p1 none 0B 0 0 0 0B 0B > |-nvme2n1p2 none 0B 0 0 0 0B 0B > `-nvme2n1p3 none 0B 0 0 0 0B 0B > nvme0n1 none 0B 0 0 0 0B 0B > nvme1n1 none 0B 0 0 0 0B 0B > nvme0n2 host-managed 2G 1844 14 14 4M 4K > nvme1n2 host-managed 2G 1844 14 14 4M 4K> > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> > --- > misc-utils/lsblk.8.adoc | 2 +- > misc-utils/lsblk.c | 8 +++++++- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/misc-utils/lsblk.8.adoc b/misc-utils/lsblk.8.adoc > index 7356976403a7..9e68a847ce0c 100644 > --- a/misc-utils/lsblk.8.adoc > +++ b/misc-utils/lsblk.8.adoc > @@ -116,7 +116,7 @@ Specifies output width as a number of characters. The default is the number of t > Sort output lines by _column_. This option enables *--list* output format by default. It is possible to use the option *--tree* to force tree-like output and than the tree branches are sorted by the _column_. > > *-z*, *--zoned*:: > -Print the zone model for each device. > +Print the zone related information for each device. > > *--sysroot* _directory_:: > Gather data for a Linux instance other than the instance from which the *lsblk* command is issued. The specified directory is the system root of the Linux instance to be inspected. The real device nodes in the target directory can be replaced by text files with udev attributes. > diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c > index 108c8187498e..8a2578312f0d 100644 > --- a/misc-utils/lsblk.c > +++ b/misc-utils/lsblk.c > @@ -1919,7 +1919,7 @@ static void __attribute__((__noreturn__)) usage(void) > fputs(_(" -t, --topology output info about topology\n"), out); > fputs(_(" -w, --width <num> specifies output width as number of characters\n"), out); > fputs(_(" -x, --sort <column> sort output by <column>\n"), out); > - fputs(_(" -z, --zoned print zone model\n"), out); > + fputs(_(" -z, --zoned print zone related information\n"), out); > fputs(_(" --sysroot <dir> use specified directory as system root\n"), out); > fputs(USAGE_SEPARATOR, out); > printf(USAGE_HELP_OPTIONS(22)); > @@ -2041,6 +2041,12 @@ int main(int argc, char *argv[]) > case 'z': > add_uniq_column(COL_NAME); > add_uniq_column(COL_ZONED); > + add_uniq_column(COL_ZONESIZE); > + add_uniq_column(COL_ZONE_NR); > + add_uniq_column(COL_ZONE_AMAX); > + add_uniq_column(COL_ZONE_OMAX); > + add_uniq_column(COL_ZONEAPPEND); > + add_uniq_column(COL_ZONEWRITEGRAN); > break; > case 'e': > parse_excludes(optarg); > Looks good, modulo the change to ZONE-WGRAN. Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> -- Damien Le Moal Western Digital Research ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-08-30 5:15 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-27 7:34 [PATCH v2 0/3] add columns for zoned parameters Naohiro Aota 2021-08-27 7:34 ` [PATCH v2 1/3] lsblk: factor out function to read sysfs param as bytes Naohiro Aota 2021-08-29 23:07 ` Damien Le Moal 2021-08-30 1:21 ` Naohiro Aota 2021-08-27 7:34 ` [PATCH v2 2/3] lsblk: add columns of zoned parameters Naohiro Aota 2021-08-29 23:10 ` Damien Le Moal 2021-08-30 1:08 ` Naohiro Aota 2021-08-30 1:50 ` Damien Le Moal 2021-08-30 5:15 ` Naohiro Aota 2021-08-29 23:15 ` Damien Le Moal 2021-08-27 7:34 ` [PATCH v2 3/3] lsblk: add zoned columns to "lsblk -z" Naohiro Aota 2021-08-29 23:14 ` Damien Le Moal
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.