lib/nvme: Add two public APIs to get ANA group ID and ANA state of the namespace

Add spdk_nvme_ns_get_ana_group_id() and spdk_nvme_ns_get_ana_state()
to getthe ANA group ID and the ANA state of the given namespace,
respectively.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id5f1f7ee488a1eb2a7a77f9986a3bb89146628e0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4354
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-09-23 03:26:26 +09:00 committed by Tomasz Zawadzki
parent cc2b6962f9
commit 583fa214a3
3 changed files with 43 additions and 0 deletions

View File

@ -2334,6 +2334,36 @@ enum spdk_nvme_ns_flags {
*/
uint32_t spdk_nvme_ns_get_flags(struct spdk_nvme_ns *ns);
/**
* Get the ANA group ID for the given namespace.
*
* This function should be called only if spdk_nvme_ctrlr_is_log_page_supported() returns
* true for the controller and log page ID SPDK_NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS.
*
* This function is thread safe and can be called at any point while the controller
* is attached to the SPDK NVMe driver.
*
* \param ns Namespace to query.
*
* \return the ANA group ID for the given namespace.
*/
uint32_t spdk_nvme_ns_get_ana_group_id(const struct spdk_nvme_ns *ns);
/**
* Get the ANA state for the given namespace.
*
* This function should be called only if spdk_nvme_ctrlr_is_log_page_supported() returns
* true for the controller and log page ID SPDK_NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS.
*
* This function is thread safe and can be called at any point while the controller
* is attached to the SPDK NVMe driver.
*
* \param ns Namespace to query.
*
* \return the ANA state for the given namespace.
*/
enum spdk_nvme_ana_state spdk_nvme_ns_get_ana_state(const struct spdk_nvme_ns *ns);
/**
* Restart the SGL walk to the specified offset when the command has scattered payloads.
*

View File

@ -397,6 +397,17 @@ spdk_nvme_ns_get_csi(const struct spdk_nvme_ns *ns) {
return ns->csi;
}
uint32_t
spdk_nvme_ns_get_ana_group_id(const struct spdk_nvme_ns *ns)
{
return ns->ana_group_id;
}
enum spdk_nvme_ana_state
spdk_nvme_ns_get_ana_state(const struct spdk_nvme_ns *ns) {
return ns->ana_state;
}
int nvme_ns_construct(struct spdk_nvme_ns *ns, uint32_t id,
struct spdk_nvme_ctrlr *ctrlr)
{

View File

@ -111,6 +111,8 @@
spdk_nvme_ns_get_uuid;
spdk_nvme_ns_get_csi;
spdk_nvme_ns_get_flags;
spdk_nvme_ns_get_ana_group_id;
spdk_nvme_ns_get_ana_state;
spdk_nvme_ns_cmd_write;
spdk_nvme_ns_cmd_writev;