nvmf: move the virtual mode related code to the virtual.c.

Change-Id: Ia68ffdd2019adba3a37295ee455e93f8e0427fa2
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
Cunyin Chang 2017-03-02 13:31:48 +08:00 committed by Daniel Verkamp
parent fca35b7b96
commit 6da9e1792a
2 changed files with 8 additions and 11 deletions

View File

@ -84,17 +84,7 @@ subsystem_delete_event(void *arg1, void *arg2)
static void
nvmf_tgt_delete_subsystem(struct nvmf_tgt_subsystem *app_subsys)
{
struct spdk_nvmf_subsystem *subsystem = app_subsys->subsystem;
struct spdk_event *event;
int i;
if (spdk_nvmf_subsystem_get_type(subsystem) == SPDK_NVMF_SUBTYPE_NVME &&
spdk_nvmf_subsystem_get_mode(subsystem) == NVMF_SUBSYSTEM_MODE_VIRTUAL) {
for (i = 0; i < subsystem->dev.virt.ns_count; i++) {
spdk_put_io_channel(subsystem->dev.virt.ch[i]);
subsystem->dev.virt.ch[i] = NULL;
}
}
/*
* Unregister the poller - this starts a chain of events that will eventually free

View File

@ -40,6 +40,7 @@
#include "spdk/bdev.h"
#include "spdk/endian.h"
#include "spdk/io_channel.h"
#include "spdk/nvme.h"
#include "spdk/nvmf_spec.h"
#include "spdk/trace.h"
@ -528,8 +529,14 @@ nvmf_virtual_ctrlr_detach(struct spdk_nvmf_subsystem *subsystem)
uint32_t i;
for (i = 0; i < subsystem->dev.virt.ns_count; i++) {
spdk_bdev_unclaim(subsystem->dev.virt.ns_list[i]);
if (subsystem->dev.virt.ns_list[i]) {
spdk_put_io_channel(subsystem->dev.virt.ch[i]);
spdk_bdev_unclaim(subsystem->dev.virt.ns_list[i]);
subsystem->dev.virt.ch[i] = NULL;
subsystem->dev.virt.ns_list[i] = NULL;
}
}
subsystem->dev.virt.ns_count = 0;
}
static void