bdev/nvme: add namespace types

Eventually these may be defined by the NVMe spec, but
for now add something local to the bdev/nvme module.
These will currently only differentiate "standard"
namespaces from ocssd namespaces.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7853c97f3d3c28fd9f2fcd2440c57dc262954b46

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475795
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-11-25 12:59:29 -07:00 committed by Tomasz Zawadzki
parent 9fa0006912
commit 62db72caaf
2 changed files with 12 additions and 0 deletions

View File

@ -1047,6 +1047,11 @@ nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
if (!ns->active && spdk_nvme_ctrlr_is_active_ns(ctrlr, nsid)) {
ns->id = nsid;
ns->ctrlr = nvme_bdev_ctrlr;
if (spdk_nvme_ctrlr_is_ocssd_supported(ctrlr)) {
ns->type = NVME_BDEV_NS_OCSSD;
} else {
ns->type = NVME_BDEV_NS_STANDARD;
}
TAILQ_INIT(&ns->bdevs);

View File

@ -44,8 +44,15 @@ extern pthread_mutex_t g_bdev_nvme_mutex;
#define NVME_MAX_CONTROLLERS 1024
enum nvme_bdev_ns_type {
NVME_BDEV_NS_UNKNOWN = 0,
NVME_BDEV_NS_STANDARD = 1,
NVME_BDEV_NS_OCSSD = 2,
};
struct nvme_bdev_ns {
uint32_t id;
enum nvme_bdev_ns_type type;
bool active;
struct spdk_nvme_ns *ns;
struct nvme_bdev_ctrlr *ctrlr;