From: Keith Busch Date: Fri, 5 Jun 2020 03:36:52 +0000 (-0700) Subject: report zones helpers X-Git-Tag: v1.0-rc0~148 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4b562745fb65d2eac5532ff59170eadb365fc7bc;p=users%2Fsagi%2Flibnvme.git report zones helpers Signed-off-by: Keith Busch --- diff --git a/src/nvme/ioctl.c b/src/nvme/ioctl.c index d2bb0727..ced189b5 100644 --- a/src/nvme/ioctl.c +++ b/src/nvme/ioctl.c @@ -1836,7 +1836,7 @@ int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba, DW(zras_feat, NVME_ZNS_MGMT_RECV_ZRAS_FEAT); struct nvme_passthru_cmd cmd = { - .opcode = nvme_zns_cmd_mgmt_send, + .opcode = nvme_zns_cmd_mgmt_recv, .nsid = nsid, .cdw10 = cdw10, .cdw11 = cdw11, @@ -1849,6 +1849,22 @@ int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba, return nvme_submit_io_passthru(fd, &cmd, NULL); } +int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba, bool extended, + enum nvme_zns_report_options opts, bool partial, + __u32 data_len, void *data) +{ + BUILD_ASSERT(sizeof(struct nvme_zns_desc) == 64); + enum nvme_zns_recv_action zra; + + if (extended) + zra = NVME_ZNS_ZRA_EXTENDED_REPORT_ZONES; + else + zra = NVME_ZNS_ZRA_REPORT_ZONES; + + return nvme_zns_mgmt_recv(fd, nsid, slba, zra, opts, partial, + data_len, data); +} + int nvme_zns_append(int fd, __u32 nsid, __u64 zslba, __u16 nlb, __u16 control, __u32 ilbrt, __u16 lbat, __u16 lbatm, __u32 data_len, void *data, __u32 metadata_len, void *metadata, diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index d1ebc687..22edcbe2 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -3077,9 +3077,27 @@ enum nvme_zns_recv_action { }; /** - * enum nvme_zns_recv_action_spec - + * nvme_zns_mgmt_recv() - + * @fd: File descriptor of nvme device + * @nsid: Namespace ID + * @slba: + * @zra: + * @zrasf: + * @zras_feat: + * @data_len: + * @data: + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. + */ +int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba, + enum nvme_zns_recv_action zra, __u16 zrasf, + bool zras_feat, __u32 data_len, void *data); + +/** + * enum nvme_zns_report_options - */ -enum nvme_zns_recv_action_spec { +enum nvme_zns_report_options { NVME_ZNS_ZRAS_REPORT_ALL = 0x0, NVME_ZNS_ZRAS_REPORT_EMPTY = 0x1, NVME_ZNS_ZRAS_REPORT_IMPL_OPENED = 0x2, @@ -3090,17 +3108,9 @@ enum nvme_zns_recv_action_spec { NVME_ZNS_ZRAS_REPORT_OFFLINE = 0x7, }; -/** - * nvme_zns_mgmt_recv() - - * @fd: File descriptor of nvme device - * @nsid: Namespace ID - * - * Return: The nvme command status if a response was received (see - * &enum nvme_status_field) or -1 with errno set otherwise. - */ -int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba, - enum nvme_zns_recv_action zra, __u16 zrasf, - bool zras_feat, __u32 data_len, void *data); +int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba, bool extended, + enum nvme_zns_report_options opts, bool partial, + __u32 data_len, void *data); /** * nvme_zns_append() -