[PATCHv2 0/9] libnvme: add support for retrieving additional NVMe stat

Daniel Wagner dwagner at suse.de
Thu Apr 9 02:10:51 PDT 2026


Hi Nilay,

On Sat, Apr 04, 2026 at 03:44:50PM +0530, Nilay Shroff wrote:
> Certain NVMe attributes and statistics can change dynamically at runtime.
> However, the current libnvme implementation caches attribute values while
> scanning and building the topology. Subsequent libnvme API calls return
> these cached values.
> 
> While this approach works well for one-shot nvme-cli commands, it is not
> suitable for use cases that require upto date information. In particular,
> real-time monitoring tools such as nvme-top require access to the latest
> (non-cached) values of such attributes.
> 
> To address this, this patchset introduces support for retrieving
> non-cached values for selected attributes whose values may change
> dynamically. The first three patches disable auto-generated accessors
> for ana_state, numa_nodes, and iopolicy using "!accessors:none", and
> provide custom implementations that always return the latest values.
> 
> In addition, libnvme lacks support for retrieving gendisk statistics, which
> provide useful insight into disk activity (e.g., number of I/Os processed,
> time spent servicing I/O, and in-flight I/O counts). This patchset adds
> support for retrieving gendisk I/O statistics for both per-path and namespace
> gendisks.
> 
> Finally, this series adds support for retrieving diagnostic counters at 
> different levels, including per-path, namespace, nshead, and controller.
> These counters should improve visibility into NVMe native multipath behavior.
> 
> All of the above statistics and counters can be leveraged by tools such as
> nvme-top to provide real-time monitoring and analysis.
> 
> As usual, feedback and suggestions are welcome!

Looks way better. Thanks!

Unfortunately, the big renaming of the API has happened, thus could I
ask to rebase (and rename the symbols accordingly)?

One thing I notices, is the first set of statistic getters have the
'bool diffstat' argument, the second one not. To make this a bit more
consistent I'd say it would be great to have it on all functions. WDYT?

Thanks,
Daniel



More information about the Linux-nvme mailing list