nvmf: defer start of subsystem until fully initialized
Starting the subsystem consists of firing an event to the subsystem poller's lcore and performing I/O channel initialization (for virtual NVMe subsystems) before starting the poller. Previously the subsystem would be started immediately when created, which was before the subsystem's mode and other parameters (such as a virtual subsystem's bdevs) have been set. This resulted in no I/O channels being allocated in virtual subsystem mode. So break out the start code into a new nvmf_tgt_start_subsystem() function, which clients must call after fully initializing a subsystem created with nvmf_tgt_create_subsystem(). Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I56534668887ef99d2e892844acd12194920c3245
This commit is contained in:
parent
89b216a2a1
commit
2848c8d1d3
@ -148,6 +148,8 @@ spdk_add_nvmf_discovery_subsystem(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
nvmf_tgt_start_subsystem(app_subsys);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -612,6 +614,9 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
nvmf_tgt_start_subsystem(app_subsys);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -805,5 +810,7 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
nvmf_tgt_start_subsystem(app_subsys);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ disconnect_cb(void *cb_ctx, struct spdk_nvmf_conn *conn)
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_tgt_start_subsystem(struct spdk_event *event)
|
||||
_nvmf_tgt_start_subsystem(struct spdk_event *event)
|
||||
{
|
||||
struct nvmf_tgt_subsystem *app_subsys = spdk_event_get_arg1(event);
|
||||
struct spdk_nvmf_subsystem *subsystem = app_subsys->subsystem;
|
||||
@ -210,12 +210,21 @@ nvmf_tgt_start_subsystem(struct spdk_event *event)
|
||||
spdk_poller_register(&app_subsys->poller, subsystem_poll, app_subsys, lcore, NULL, 0);
|
||||
}
|
||||
|
||||
void
|
||||
nvmf_tgt_start_subsystem(struct nvmf_tgt_subsystem *app_subsys)
|
||||
{
|
||||
spdk_event_t event;
|
||||
|
||||
event = spdk_event_allocate(app_subsys->lcore, _nvmf_tgt_start_subsystem,
|
||||
app_subsys, NULL, NULL);
|
||||
spdk_event_call(event);
|
||||
}
|
||||
|
||||
struct nvmf_tgt_subsystem *
|
||||
nvmf_tgt_create_subsystem(int num, const char *name, enum spdk_nvmf_subtype subtype, uint32_t lcore)
|
||||
{
|
||||
struct spdk_nvmf_subsystem *subsystem;
|
||||
struct nvmf_tgt_subsystem *app_subsys;
|
||||
struct spdk_event *event;
|
||||
|
||||
app_subsys = calloc(1, sizeof(*app_subsys));
|
||||
if (app_subsys == NULL) {
|
||||
@ -236,8 +245,6 @@ nvmf_tgt_create_subsystem(int num, const char *name, enum spdk_nvmf_subtype subt
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, "allocated subsystem %p on lcore %u\n", subsystem, lcore);
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_subsystems, app_subsys, tailq);
|
||||
event = spdk_event_allocate(lcore, nvmf_tgt_start_subsystem, app_subsys, NULL, NULL);
|
||||
spdk_event_call(event);
|
||||
|
||||
return app_subsys;
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ nvmf_tgt_subsystem_next(struct nvmf_tgt_subsystem *subsystem);
|
||||
|
||||
int spdk_nvmf_parse_conf(void);
|
||||
|
||||
void nvmf_tgt_start_subsystem(struct nvmf_tgt_subsystem *subsystem);
|
||||
|
||||
struct nvmf_tgt_subsystem *nvmf_tgt_create_subsystem(int num,
|
||||
const char *name,
|
||||
enum spdk_nvmf_subtype subtype,
|
||||
|
Loading…
x
Reference in New Issue
Block a user