Commit e2104c33 authored by Ben Walker's avatar Ben Walker Committed by Darek Stojaczyk
Browse files

event: Don't construct rpc and json events until bootstrapped



These can now be delayed. Next they'll be converted to thread
operations instead of events.

Change-Id: Id8c183621fb88594a9fd508eff064b4a1557a5b6
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446989


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent c274db3b
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -68,8 +68,6 @@ struct spdk_app {

static struct spdk_app g_spdk_app;
static struct spdk_event *g_app_start_event = NULL;
struct spdk_event *g_rpc_start_event = NULL;
struct spdk_event *g_config_load_event = NULL;
static struct spdk_event *g_shutdown_event = NULL;
static int g_init_lcore;
static bool g_delay_subsystem_init = false;
@@ -566,13 +564,22 @@ spdk_app_setup_trace(struct spdk_app_opts *opts)
static void
bootstrap_fn(void *arg1, void *arg2)
{
	if (g_config_load_event) {
		spdk_event_call(g_config_load_event);
	struct spdk_event *rpc_start_event;
	struct spdk_event *config_load_event;

	rpc_start_event = spdk_event_allocate(g_init_lcore, spdk_app_start_rpc,
					      NULL, NULL);

	if (g_spdk_app.json_config_file) {
		g_delay_subsystem_init = false;
		config_load_event = spdk_event_allocate(g_init_lcore, _spdk_app_json_config_load,
							rpc_start_event, NULL);
		spdk_event_call(config_load_event);
	} else {
		if (!g_delay_subsystem_init) {
			spdk_subsystem_init(g_rpc_start_event);
			spdk_subsystem_init(rpc_start_event);
		} else {
			spdk_event_call(g_rpc_start_event);
			spdk_event_call(rpc_start_event);
		}
	}
}
@@ -675,14 +682,6 @@ spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn,

	event = spdk_event_allocate(g_init_lcore, bootstrap_fn, NULL, NULL);
	g_app_start_event = spdk_event_allocate(g_init_lcore, start_fn, arg1, NULL);
	g_rpc_start_event = spdk_event_allocate(g_init_lcore, spdk_app_start_rpc,
						NULL, NULL);

	if (opts->json_config_file) {
		g_delay_subsystem_init = false;
		g_config_load_event = spdk_event_allocate(g_init_lcore, _spdk_app_json_config_load,
				      g_rpc_start_event, NULL);
	}

	spdk_event_call(event);