lib/event: remove app.c dependency from loading json_config
Originally loading json_config using spdk_app_json_config_load_subsystem() implied issuing start_subsystem_init RPC. This required a workaround in the callback of RPC spdk_rpc_start_subsystem_init_cpl(), in order to skip starting the app in json_config load path. This made it difficult to load json_config without implicitly using rest of the event framework. It will be usefull for example in fio_plugin, which does not use the app.c API. With change in this patch json_config load path directly calls spdk_subsystem_init() C call. Meanwhile start_subsystem_init RPC no longer needs a workaround for json_config load path. Change-Id: I535e079339cedaf0950767a8204002ab5885d8a5 Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463978 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
a744bf83ff
commit
1428692e1a
@ -1070,14 +1070,7 @@ spdk_rpc_start_subsystem_init_cpl(int rc, void *arg1)
|
||||
}
|
||||
|
||||
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
|
||||
/* If we're loading JSON config file, we're still operating on a fake,
|
||||
* temporary RPC server. We'll have to defer calling the app start callback
|
||||
* until this temporary server is shut down and a real one - listening on
|
||||
* the proper socket - is started.
|
||||
*/
|
||||
if (g_spdk_app.json_config_file == NULL) {
|
||||
spdk_app_start_application();
|
||||
}
|
||||
spdk_app_start_application();
|
||||
|
||||
w = spdk_jsonrpc_begin_result(request);
|
||||
spdk_json_write_bool(w, true);
|
||||
|
@ -390,13 +390,20 @@ out:
|
||||
}
|
||||
|
||||
static void
|
||||
subsystem_init_done_resp_cb(struct load_json_config_ctx *ctx,
|
||||
struct spdk_jsonrpc_client_response *resp)
|
||||
subsystem_init_done(int rc, void *arg1)
|
||||
{
|
||||
spdk_jsonrpc_client_free_response(resp);
|
||||
struct load_json_config_ctx *ctx = arg1;
|
||||
|
||||
if (rc) {
|
||||
spdk_app_json_config_load_done(ctx, rc);
|
||||
return;
|
||||
}
|
||||
|
||||
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
|
||||
/* Another round. This time for RUNTIME methods */
|
||||
SPDK_DEBUG_APP_CFG("'start_subsystem_init' done - continuing configuration\n");
|
||||
|
||||
assert(ctx != NULL);
|
||||
if (ctx->subsystems) {
|
||||
ctx->subsystems_it = spdk_json_array_first(ctx->subsystems);
|
||||
}
|
||||
@ -430,27 +437,11 @@ static void
|
||||
spdk_app_json_config_load_subsystem(void *_ctx)
|
||||
{
|
||||
struct load_json_config_ctx *ctx = _ctx;
|
||||
struct spdk_jsonrpc_client_request *req;
|
||||
struct spdk_json_write_ctx *w;
|
||||
|
||||
if (ctx->subsystems_it == NULL) {
|
||||
if (spdk_rpc_get_state() == SPDK_RPC_STARTUP) {
|
||||
SPDK_DEBUG_APP_CFG("No more entries for current state, calling 'start_subsystem_init'\n");
|
||||
req = spdk_jsonrpc_client_create_request();
|
||||
if (!req) {
|
||||
spdk_app_json_config_load_done(ctx, -ENOMEM);
|
||||
return;
|
||||
}
|
||||
|
||||
w = spdk_jsonrpc_begin_request(req, ctx->rpc_request_id++, "start_subsystem_init");
|
||||
if (!w) {
|
||||
spdk_jsonrpc_client_free_request(req);
|
||||
spdk_app_json_config_load_done(ctx, -ENOMEM);
|
||||
return;
|
||||
}
|
||||
spdk_jsonrpc_end_request(req, w);
|
||||
|
||||
client_send_request(ctx, req, subsystem_init_done_resp_cb);
|
||||
spdk_subsystem_init(subsystem_init_done, ctx);
|
||||
} else {
|
||||
spdk_app_json_config_load_done(ctx, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user