nvmf: Create poll groups on their respective cores
Previously, all of the poll groups were created on the core doing the configuration. However, creating poll groups will eventually construct the I/O channels, and that must be done on the core we plan to use the poll group on. Change-Id: Iff57ac0e43bb722eb27cf01d7bf55f3946a165eb Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/385515 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
db3edeb341
commit
07c639cdec
@ -223,11 +223,43 @@ nvmf_tgt_poll_group_poll(void *arg)
|
||||
spdk_nvmf_poll_group_poll(app_poll_group->group);
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_tgt_create_poll_group_done(void *arg1, void *arg2)
|
||||
{
|
||||
struct nvmf_tgt_poll_group *pg;
|
||||
|
||||
pg = &g_poll_groups[g_tgt.core];
|
||||
if (pg->group == NULL) {
|
||||
g_tgt.state = NVMF_TGT_ERROR;
|
||||
} else {
|
||||
g_tgt.state = NVMF_TGT_INIT_START_POLLER;
|
||||
}
|
||||
|
||||
nvmf_tgt_advance_state(NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_tgt_create_poll_group(void *arg1, void *arg2)
|
||||
{
|
||||
struct nvmf_tgt_poll_group *pg;
|
||||
struct spdk_event *event = arg1;
|
||||
|
||||
assert(g_tgt.core == spdk_env_get_current_core());
|
||||
|
||||
pg = &g_poll_groups[g_tgt.core];
|
||||
pg->group = spdk_nvmf_poll_group_create(g_tgt.tgt);
|
||||
if (pg->group == NULL) {
|
||||
SPDK_ERRLOG("Failed to create poll group for core %u\n", g_tgt.core);
|
||||
}
|
||||
|
||||
spdk_event_call(event);
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_tgt_advance_state(void *arg1, void *arg2)
|
||||
{
|
||||
enum nvmf_tgt_state prev_state;
|
||||
int rc = 0;
|
||||
int rc = -1;
|
||||
|
||||
do {
|
||||
prev_state = g_tgt.state;
|
||||
@ -271,26 +303,18 @@ nvmf_tgt_advance_state(void *arg1, void *arg2)
|
||||
g_tgt.state = NVMF_TGT_INIT_CREATE_POLL_GROUP;
|
||||
break;
|
||||
case NVMF_TGT_INIT_CREATE_POLL_GROUP: {
|
||||
struct nvmf_tgt_poll_group *pg;
|
||||
struct spdk_event *event, *return_event;
|
||||
|
||||
pg = &g_poll_groups[g_tgt.core];
|
||||
assert(pg != NULL);
|
||||
|
||||
pg->group = spdk_nvmf_poll_group_create(g_tgt.tgt);
|
||||
if (pg->group == NULL) {
|
||||
SPDK_ERRLOG("Failed to create poll group for core %u\n", g_tgt.core);
|
||||
rc = -ENOMEM;
|
||||
g_tgt.state = NVMF_TGT_ERROR;
|
||||
break;
|
||||
}
|
||||
g_tgt.state = NVMF_TGT_INIT_START_POLLER;
|
||||
/* Send an event to the poller core, create an event, and event back to this core. */
|
||||
return_event = spdk_event_allocate(spdk_env_get_current_core(), nvmf_tgt_create_poll_group_done,
|
||||
NULL, NULL);
|
||||
event = spdk_event_allocate(g_tgt.core, nvmf_tgt_create_poll_group,
|
||||
return_event, NULL);
|
||||
spdk_event_call(event);
|
||||
break;
|
||||
}
|
||||
case NVMF_TGT_INIT_START_POLLER: {
|
||||
struct nvmf_tgt_poll_group *pg;
|
||||
|
||||
pg = &g_poll_groups[g_tgt.core];
|
||||
assert(pg != NULL);
|
||||
struct nvmf_tgt_poll_group *pg = &g_poll_groups[g_tgt.core];
|
||||
|
||||
spdk_poller_register(&pg->poller,
|
||||
nvmf_tgt_poll_group_poll, pg,
|
||||
|
Loading…
Reference in New Issue
Block a user