From: Naohiro Aota <Naohiro.Aota@wdc.com>
To: Damien Le Moal <Damien.LeMoal@wdc.com>
Cc: Karel Zak <kzak@redhat.com>,
"util-linux@vger.kernel.org" <util-linux@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] lsblk: add columns of zoned parameters
Date: Mon, 30 Aug 2021 01:08:06 +0000 [thread overview]
Message-ID: <20210830010806.w2v2zmm6i5smcoou@naota-xeon> (raw)
In-Reply-To: <DM6PR04MB7081F921F5DF2E1D8E35D350E7CA9@DM6PR04MB7081.namprd04.prod.outlook.com>
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
>
next prev parent reply other threads:[~2021-08-30 1:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=20210830010806.w2v2zmm6i5smcoou@naota-xeon \
--to=naohiro.aota@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=kzak@redhat.com \
--cc=util-linux@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).