bdev: Move event subsystem initialization to event_bdev
This breaks the dependency on the event subsystem logic. Change-Id: Ic47a219bc1e272c3421b265f74bba959e1aa5f62 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/365730 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
aacd61d54a
commit
90779f58c7
@ -41,7 +41,6 @@
|
|||||||
|
|
||||||
#include "spdk/stdinc.h"
|
#include "spdk/stdinc.h"
|
||||||
|
|
||||||
#include "spdk/event.h"
|
|
||||||
#include "spdk/scsi_spec.h"
|
#include "spdk/scsi_spec.h"
|
||||||
#include "spdk/nvme_spec.h"
|
#include "spdk/nvme_spec.h"
|
||||||
|
|
||||||
@ -107,7 +106,9 @@ struct spdk_bdev_io_stat {
|
|||||||
uint64_t num_write_ops;
|
uint64_t num_write_ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
void spdk_bdev_initialize(void);
|
typedef void (*spdk_bdev_init_cb)(void *cb_arg, int rc);
|
||||||
|
|
||||||
|
void spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg);
|
||||||
int spdk_bdev_finish(void);
|
int spdk_bdev_finish(void);
|
||||||
void spdk_bdev_config_text(FILE *fp);
|
void spdk_bdev_config_text(FILE *fp);
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include "spdk/scsi_spec.h"
|
#include "spdk/scsi_spec.h"
|
||||||
|
|
||||||
#include "spdk_internal/bdev.h"
|
#include "spdk_internal/bdev.h"
|
||||||
#include "spdk_internal/event.h"
|
|
||||||
#include "spdk_internal/log.h"
|
#include "spdk_internal/log.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
|
||||||
@ -82,6 +81,8 @@ static struct spdk_bdev_mgr g_bdev_mgr = {
|
|||||||
|
|
||||||
static struct spdk_bdev_module_if *g_next_bdev_module;
|
static struct spdk_bdev_module_if *g_next_bdev_module;
|
||||||
static struct spdk_bdev_module_if *g_next_vbdev_module;
|
static struct spdk_bdev_module_if *g_next_vbdev_module;
|
||||||
|
static spdk_bdev_init_cb g_cb_fn = NULL;
|
||||||
|
static void *g_cb_arg = NULL;
|
||||||
|
|
||||||
struct spdk_bdev_mgmt_channel {
|
struct spdk_bdev_mgmt_channel {
|
||||||
need_buf_tailq_t need_buf_small;
|
need_buf_tailq_t need_buf_small;
|
||||||
@ -298,13 +299,25 @@ spdk_bdev_mgmt_channel_destroy(void *io_device, void *ctx_buf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spdk_bdev_init_complete(int rc)
|
||||||
|
{
|
||||||
|
spdk_bdev_init_cb cb_fn = g_cb_fn;
|
||||||
|
void *cb_arg = g_cb_arg;
|
||||||
|
|
||||||
|
g_cb_fn = NULL;
|
||||||
|
g_cb_arg = NULL;
|
||||||
|
|
||||||
|
cb_fn(cb_arg, rc);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spdk_bdev_module_init_next(int rc)
|
spdk_bdev_module_init_next(int rc)
|
||||||
{
|
{
|
||||||
if (rc) {
|
if (rc) {
|
||||||
assert(g_next_bdev_module != NULL);
|
assert(g_next_bdev_module != NULL);
|
||||||
SPDK_ERRLOG("Failed to init bdev module: %s\n", g_next_bdev_module->module_name);
|
SPDK_ERRLOG("Failed to init bdev module: %s\n", g_next_bdev_module->module_name);
|
||||||
spdk_subsystem_init_next(rc);
|
spdk_bdev_init_complete(rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +340,7 @@ spdk_vbdev_module_init_next(int rc)
|
|||||||
if (rc) {
|
if (rc) {
|
||||||
assert(g_next_vbdev_module != NULL);
|
assert(g_next_vbdev_module != NULL);
|
||||||
SPDK_ERRLOG("Failed to init vbdev module: %s\n", g_next_vbdev_module->module_name);
|
SPDK_ERRLOG("Failed to init vbdev module: %s\n", g_next_vbdev_module->module_name);
|
||||||
spdk_subsystem_init_next(rc);
|
spdk_bdev_init_complete(rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,16 +353,21 @@ spdk_vbdev_module_init_next(int rc)
|
|||||||
if (g_next_vbdev_module) {
|
if (g_next_vbdev_module) {
|
||||||
g_next_vbdev_module->module_init();
|
g_next_vbdev_module->module_init();
|
||||||
} else {
|
} else {
|
||||||
spdk_subsystem_init_next(0);
|
spdk_bdev_init_complete(rc);;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spdk_bdev_initialize(void)
|
spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg)
|
||||||
{
|
{
|
||||||
int cache_size;
|
int cache_size;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
assert(cb_fn != NULL);
|
||||||
|
|
||||||
|
g_cb_fn = cb_fn;
|
||||||
|
g_cb_arg = cb_arg;
|
||||||
|
|
||||||
g_bdev_mgr.bdev_io_pool = spdk_mempool_create("blockdev_io",
|
g_bdev_mgr.bdev_io_pool = spdk_mempool_create("blockdev_io",
|
||||||
SPDK_BDEV_IO_POOL_SIZE,
|
SPDK_BDEV_IO_POOL_SIZE,
|
||||||
sizeof(struct spdk_bdev_io) +
|
sizeof(struct spdk_bdev_io) +
|
||||||
|
@ -37,5 +37,24 @@
|
|||||||
|
|
||||||
#include "spdk_internal/event.h"
|
#include "spdk_internal/event.h"
|
||||||
|
|
||||||
SPDK_SUBSYSTEM_REGISTER(bdev, spdk_bdev_initialize, spdk_bdev_finish, spdk_bdev_config_text)
|
static void
|
||||||
|
spdk_bdev_initialize_complete(void *cb_arg, int rc)
|
||||||
|
{
|
||||||
|
spdk_subsystem_init_next(rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spdk_bdev_subsystem_initialize(void)
|
||||||
|
{
|
||||||
|
spdk_bdev_initialize(spdk_bdev_initialize_complete, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
spdk_bdev_subsystem_finish(void)
|
||||||
|
{
|
||||||
|
return spdk_bdev_finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
SPDK_SUBSYSTEM_REGISTER(bdev, spdk_bdev_subsystem_initialize,
|
||||||
|
spdk_bdev_subsystem_finish, spdk_bdev_config_text)
|
||||||
SPDK_SUBSYSTEM_DEPEND(bdev, copy)
|
SPDK_SUBSYSTEM_DEPEND(bdev, copy)
|
||||||
|
Loading…
Reference in New Issue
Block a user