lib/nvme: Add spdk_nvme_ns_get_ctrlr to the public api

This can be used in callbacks when a user has a namespace but needs to
call controller specific functions such as alloc_io_qpair.

Change-Id: I00c931e2846e42f540c17f3254fe97a45e9bd079
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/375022
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Seth Howell 2017-08-21 10:32:22 -07:00 committed by Daniel Verkamp
parent 59f2a376a3
commit d21ec1f00d
3 changed files with 18 additions and 0 deletions

View File

@ -29,6 +29,9 @@ into account when splitting I/O requests.
The HotplugEnable option in `[Nvme]` sections of the configuration file is now
"No" by default. It was previously "Yes".
The NVMe library now includes a function spdk_nvme_ns_get_ctrlr which returns the
NVMe Controller associated with a given namespace.
### NVMe-oF Target (nvmf)
The NVMe-oF target no longer requires any in capsule data buffers to run, and
@ -42,6 +45,7 @@ additional clarity when constructing spdk_mempools. Previously, -1 could be
passed and the library would choose a reasonable default, but this new value
makes it explicit that the default is being used.
## v17.07: Build system improvements, userspace vhost-blk target, and GPT bdev
### Build System

View File

@ -847,6 +847,14 @@ const struct spdk_nvme_ns_data *spdk_nvme_ns_get_data(struct spdk_nvme_ns *ns);
*/
uint32_t spdk_nvme_ns_get_id(struct spdk_nvme_ns *ns);
/**
* \brief Get the Controller with which this namespace is associated.
*
* This function is thread safe and can be called at any point while the controller is attached to
* the SPDK NVMe driver.
*/
struct spdk_nvme_ctrlr *spdk_nvme_ns_get_ctrlr(struct spdk_nvme_ns *ns);
/**
* \brief Determine whether a namespace is active.
*

View File

@ -143,6 +143,12 @@ spdk_nvme_ns_is_active(struct spdk_nvme_ns *ns)
return nsdata->ncap != 0;
}
struct spdk_nvme_ctrlr *
spdk_nvme_ns_get_ctrlr(struct spdk_nvme_ns *ns)
{
return ns->ctrlr;
}
uint32_t
spdk_nvme_ns_get_max_io_xfer_size(struct spdk_nvme_ns *ns)
{