nvmf: add the unique subsystem id

Change-Id: I0369b7462a12aec76d52dd357d72989886de5a54
Signed-off-by: GangCao <gang.cao@intel.com>
This commit is contained in:
GangCao 2017-03-03 12:24:16 +08:00
parent aa2de5c6f6
commit 360d3813b0
4 changed files with 6 additions and 0 deletions

View File

@ -126,6 +126,7 @@ struct spdk_nvmf_subsystem_allowed_listener {
* access to all the NVMe device/namespaces maintained by the subsystem.
*/
struct spdk_nvmf_subsystem {
uint32_t id;
uint32_t lcore;
char subnqn[SPDK_NVMF_NQN_MAX_LEN];
enum spdk_nvmf_subsystem_mode mode;

View File

@ -61,6 +61,7 @@ spdk_nvmf_tgt_init(uint16_t max_queue_depth, uint16_t max_queues_per_sess,
g_nvmf_tgt.discovery_genctr = 0;
g_nvmf_tgt.discovery_log_page = NULL;
g_nvmf_tgt.discovery_log_page_size = 0;
g_nvmf_tgt.current_subsystem_id = 0;
TAILQ_INIT(&g_nvmf_tgt.subsystems);
TAILQ_INIT(&g_nvmf_tgt.listen_addrs);

View File

@ -56,6 +56,7 @@ struct spdk_nvmf_tgt {
struct spdk_nvmf_discovery_log_page *discovery_log_page;
size_t discovery_log_page_size;
TAILQ_HEAD(, spdk_nvmf_listen_addr) listen_addrs;
uint32_t current_subsystem_id;
};
extern struct spdk_nvmf_tgt g_nvmf_tgt;

View File

@ -193,6 +193,9 @@ spdk_nvmf_create_subsystem(const char *nqn,
return NULL;
}
g_nvmf_tgt.current_subsystem_id++;
subsystem->id = g_nvmf_tgt.current_subsystem_id;
subsystem->subtype = type;
subsystem->mode = mode;
subsystem->cb_ctx = cb_ctx;