nvme-cli: add changed log ns support
Subsystems (2)
PATCH 1/2 nvme-cli: add changed log ns support
--- linux/nvme.h | 7 +++++++ nvme-builtin.h | 1 + nvme-ioctl.c | 6 ++++++ nvme-ioctl.h | 2 ++ nvme-print.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ nvme-print.h | 2 ++ nvme.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 126 insertions(+)
linux/nvme.h +7 -0
@@ -473,6 +473,12 @@ struct nvme_fw_slot_info_log {__u8 rsvd64[448 ]; }; +#define NVME_MAX_CHANGED_NAMESPACES 1024 + +struct nvme_changed_ns_list_log { +__le32 log[NVME_MAX_CHANGED_NAMESPACES ]; +}; +enum {NVME_CMD_EFFECTS_CSUPP =1 <<0 ,NVME_CMD_EFFECTS_LBCC =1 <<1 ,
@@ -845,6 +851,7 @@ enum {NVME_LOG_ERROR =0x01 ,NVME_LOG_SMART =0x02 ,NVME_LOG_FW_SLOT =0x03 , +NVME_LOG_CHANGED_NS =0x04 ,NVME_LOG_CMD_EFFECTS =0x05 ,NVME_LOG_DEVICE_SELF_TEST =0x06 , NVME_LOG_TELEMETRY_HOST = 0x07,
nvme-builtin.h +1 -0
@@ -22,6 +22,7 @@ COMMAND_LIST( ENTRY("get-log", "Generic NVMe get log, returns log in raw format", get_log) ENTRY("telemetry-log", "Retrieve FW Telemetry log write to file", get_telemetry_log) ENTRY("fw-log", "Retrieve FW Log, show it", get_fw_log) + ENTRY("changed-ns-list-log", "Retrieve Changed Namespace List, show it", get_changed_ns_list_log) ENTRY("smart-log", "Retrieve SMART Log, show it", get_smart_log) ENTRY("error-log", "Retrieve Error Log, show it", get_error_log)ENTRY ("effects-log" ,"Retrieve Command Effects Log, show it" , get_effects_log)
nvme-ioctl.c +6 -0
@@ -458,6 +458,12 @@ int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log)return nvme_get_log (fd,NVME_NSID_ALL ,NVME_LOG_FW_SLOT ,sizeof (*fw_log), fw_log); } +int nvme_changed_ns_list_log (int fd,struct nvme_changed_ns_list_log *changed_ns_list_log) +{ +return nvme_get_log (fd,0 ,NVME_LOG_CHANGED_NS ,sizeof (changed_ns_list_log->log), + changed_ns_list_log->log); +} +int nvme_error_log (int fd,int entries,struct nvme_error_log_page *err_log) {return nvme_get_log (fd,NVME_NSID_ALL ,NVME_LOG_ERROR , entries *sizeof (*err_log), err_log);
nvme-ioctl.h +2 -0
@@ -94,6 +94,8 @@ int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data);int nvme_get_telemetry_log (int fd,void *lp,int generate_report,int ctrl_gen,size_t log_page_size,__u64 offset);int nvme_fw_log (int fd,struct nvme_firmware_log_page *fw_log); +int nvme_changed_ns_list_log (int fd, +struct nvme_changed_ns_list_log *changed_ns_list_log);int nvme_error_log (int fd,int entries,struct nvme_error_log_page *err_log);int nvme_smart_log (int fd,__u32 nsid,struct nvme_smart_log *smart_log);int nvme_effects_log (int fd,struct nvme_effects_log_page *effects_log);
nvme-print.c +52 -0
64 lines not on this page · raw message
nvme-print.h +2 -0
@@ -27,6 +27,7 @@ void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const charvoid show_self_test_log (struct nvme_self_test_log *self_test,const char *devname);void show_fw_log (struct nvme_firmware_log_page *fw_log,const char *devname);void show_effects_log (struct nvme_effects_log_page *effects,unsigned int flags); +void show_changed_ns_list_log (struct nvme_changed_ns_list_log *log,const char *devname);void show_endurance_log (struct nvme_endurance_group_log *endurance_group,__u16 group_id,const char *devname);void show_sanitize_log (struct nvme_sanitize_log_page *sanitize,unsigned int mode,const char *devname);
@@ -50,6 +51,7 @@ void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const charvoid json_effects_log (struct nvme_effects_log_page *effects_log,const char *devname);void json_sanitize_log (struct nvme_sanitize_log_page *sanitize_log,const char *devname);void json_fw_log (struct nvme_firmware_log_page *fw_log,const char *devname); +void json_changed_ns_list_log (struct nvme_changed_ns_list_log *log,const char *devname);void json_endurance_log (struct nvme_endurance_group_log *endurance_group,__u16 group_id,const char *devname);void json_print_list_items (struct list_item *items,unsigned amnt);
nvme.c +56 -0
62 lines not on this page · raw message
Signature · 1 line
2.17.0
PATCH 2/2 nvme-cli: add changed-ns-list-log documentation
--- Documentation/nvme-changed-ns-list-log.1 | 106 +++ Documentation/nvme-changed-ns-list-log.html | 838 ++++++++++++++++++++ Documentation/nvme-changed-ns-list-log.txt | 58 ++ 3 files changed, 1002 insertions(+) create mode 100644 Documentation/nvme-changed-ns-list-log.1 create mode 100644 Documentation/nvme-changed-ns-list-log.html create mode 100644 Documentation/nvme-changed-ns-list-log.txt
Documentation/nvme-changed-ns-list-log.1 new file +106 -0
@@ -0,0 +1,106 @@ +'\" t +.\" Title: nvme-changed-ns-list-log +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 06/08/2018 +.\" Manual: NVMe Manual +.\" Source: NVMe +.\" Language: English +.\" +.TH "NVME\-CHANGED\-NS\-L" "1" "06/08/2018" "NVMe" "NVMe Manual" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +nvme-changed-ns-list-log \- Send NVMe Changed Namespace List log page request, returns result and log\&. +.SH "SYNOPSIS" +.sp +.nf +\fInvme changed\-ns\-list\-log\fR <device> [\-\-raw\-binary | \-b] + [\-\-output\-format=<fmt> | \-o <fmt>] +.fi +.SH "DESCRIPTION" +.sp +Retrieves the NVMe Changed Namespace List log page from an NVMe device and provides the retuned structure\&. +.sp +The <device> parameter is mandatory and must be a NVMe character device (ex: /dev/nvme0)\&. +.sp +On success, the returned Changed Namespace List log structure may be returned in one of several ways depending on the option flags; the structure may parsed by the program and printed in a readable format or the raw buffer may be printed to stdout for another program to parse\&. +.SH "OPTIONS" +.PP +\-b, \-\-raw\-binary +.RS 4 +Print the raw Changed Namespace List log buffer to stdout\&. +.RE +.PP +\-o <format>, \-\-output\-format=<format> +.RS 4 +Set the reporting format to +\fInormal\fR, +\fIjson\fR, or +\fIbinary\fR\&. Only one output format can be used at a time\&. +.RE +.SH "EXAMPLES" +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Print the Changed Namespace List Log page in a human readable format: +.sp +.if n \{\ +.RS 4 +.\} +.nf +# nvme changed\-ns\-list\-log /dev/nvme0 +.fi +.if n \{\ +.RE +.\} +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +Print the raw Changed Namespace List Log to a file: +.sp +.if n \{\ +.RS 4 +.\} +.nf +# nvme changed\-ns\-list\-log /dev/nvme0 \-\-raw\-binary > log\&.raw +.fi +.if n \{\ +.RE +.\} +.sp +It is probably a bad idea to not redirect stdout when using this mode\&. +.RE +.SH "NVME" +.sp +Part of the nvme\-user suite
Documentation/nvme-changed-ns-list-log.html new file +838 -0
838 lines not on this page · raw message
Documentation/nvme-changed-ns-list-log.txt new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.17.0
PATCH 1/2 nvme-cli: add changed log ns support
In reply to Chaitanya KulkarniNeeds a least a bit of a changelog.
What is the use case given that this is mostly something for the driver to look into given that self-clearing nature.
PATCH 1/2 nvme-cli: add changed log ns support
Sure I can resend with changelog.
We want to use this log page in?blktests?after NS create/delete operations to make sure it's empty and everything is clear.
In case if that is not going to be helpful we can drop this patch, please let me.
From: Christoph Hellwig <[email protected]>
Sent: Friday, June 15, 2018 2:39 AM
To: Chaitanya Kulkarni
Cc: linux-nvme at lists.infradead.org; keith.busch at intel.com
Subject: Re: [PATCH 1/2] nvme-cli: add changed log ns support ?
Needs a least a bit of a changelog.
What is the use case given that this is mostly something for the driver to look into given that self-clearing nature.
A message that is not in the archive (sent off-list or not yet received): BN6PR04MB1203F311FCFAB2BCE621C042867E0@BN6PR04MB1203.namprd04.prod.outlook.com
PATCH 1/2 nvme-cli: add changed log ns support
Quoted 4 lines · Chaitanya Kulkarni
(+ CC: Johannes Thumshirn)
Keith/Johannes, can we please review these patches?
Hmm I can't find the original patch but aprart from the obvious whitespace damage of this one it looks ok.
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Keith Busch
AppliedPATCH 1/2 nvme-cli: add changed log ns support
Applied, thank you!