nvme-pci: add NVMe controller statistics
PATCH v3 1/1 nvme-pci: add NVMe controller statistics
This is to count the controller warning events.
The statistics counters can be used to check the warning behavior cause. It is for any unstable issue behavior caused on a drive.
There is no performance impact since only counts for the warning cases. The read-write attributes then user can reset the counter value if needed. And accumulate the counter value on user application.
But it is also okay for the purpose as not be very long for the lifetime.
---
Changes since v2 to v3:
- Update the commit log.
Changes since v1:
- Split the sysfs stats attribute to create 4 new files.
- Create stats subdirectory for the attibutes split.
- Change the device attributes to read-write version.
drivers/nvme/host/nvme.h | 9 +++ drivers/nvme/host/pci.c | 127 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+)
drivers/nvme/host/nvme.h +9 -0
@@ -277,6 +277,13 @@ enum nvme_ctrl_flags { NVME_CTRL_FROZEN = 6, }; +struct nvme_stats { +unsigned long timeouts; +unsigned long aborts; +unsigned long resets; +unsigned long disables; +}; +struct nvme_ctrl {bool comp_seen;bool identified;
@@ -411,6 +418,8 @@ struct nvme_ctrl {enum nvme_ctrl_type cntrltype;enum nvme_dctype dctype;u16 awupf;/* 0's based value. */ + +struct nvme_stats stats; };static inline enum nvme_ctrl_state nvme_ctrl_state (struct nvme_ctrl *ctrl)
drivers/nvme/host/pci.c +127 -0
172 lines not on this page · raw message
Signature · 1 line
2.48.1