From a11b2f3058f772fd2f415b79d38777df7ca63211 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 8 Mar 2018 13:11:57 +0900 Subject: [PATCH] iscsi: Move poll_group init to the end of iSCSI subsystem init iSCSI poll_group initialization must be completed before starting JSON-RPC. This doesn't have any dependency to the other iSCSI subsystem initialization and completes asynchronously. Hence thisis good to be placed at the end of iSCSI subsystem initialization. Besides, object creation of iSCSI configurable components started after poll_group initialization by .INI config file is aggregated into a function spdk_iscsi_parse_iscsi_configuration(). Naming rule was adopted from NVMf-tgt. The purpose of the patch series is - to separate iSCSI subsystem initialization and iSCSI subsystem configuration, and - to develop a new JSON-RPC by reusing the separated iSCSI subsystem initialization. Change-Id: I44421803268361f53840a7e47f07ce95c13d1139 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/403145 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- lib/iscsi/iscsi_subsystem.c | 55 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index bcca784209..15a958b1d9 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -860,12 +860,6 @@ spdk_iscsi_poll_group_handle_nop(void *ctx) } } -static void -iscsi_create_poll_group_done(void *ctx) -{ - spdk_iscsi_init_complete(0); -} - static void iscsi_create_poll_group(void *ctx) { @@ -915,6 +909,32 @@ spdk_initialize_iscsi_poll_group(spdk_thread_fn cpl) spdk_for_each_thread(iscsi_create_poll_group, NULL, cpl); } +static void +spdk_iscsi_parse_iscsi_configuration(void *ctx) +{ + int rc; + + rc = spdk_iscsi_portal_grp_array_create(); + if (rc < 0) { + SPDK_ERRLOG("spdk_iscsi_portal_grp_array_create() failed\n"); + goto end; + } + + rc = spdk_iscsi_init_grp_array_create(); + if (rc < 0) { + SPDK_ERRLOG("spdk_iscsi_init_grp_array_create() failed\n"); + goto end; + } + + rc = spdk_iscsi_init_tgt_nodes(); + if (rc < 0) { + SPDK_ERRLOG("spdk_iscsi_init_tgt_nodes() failed\n"); + } + +end: + spdk_iscsi_init_complete(rc); +} + void spdk_iscsi_init(spdk_iscsi_init_cb cb_fn, void *cb_arg) { @@ -938,28 +958,7 @@ spdk_iscsi_init(spdk_iscsi_init_cb cb_fn, void *cb_arg) return; } - rc = spdk_iscsi_portal_grp_array_create(); - if (rc < 0) { - SPDK_ERRLOG("spdk_iscsi_portal_grp_array_create() failed\n"); - spdk_iscsi_init_complete(-1); - return; - } - - rc = spdk_iscsi_init_grp_array_create(); - if (rc < 0) { - SPDK_ERRLOG("spdk_iscsi_init_grp_array_create() failed\n"); - spdk_iscsi_init_complete(-1); - return; - } - - rc = spdk_iscsi_init_tgt_nodes(); - if (rc < 0) { - SPDK_ERRLOG("spdk_iscsi_init_tgt_nodes() failed\n"); - spdk_iscsi_init_complete(-1); - return; - } - - spdk_initialize_iscsi_poll_group(iscsi_create_poll_group_done); + spdk_initialize_iscsi_poll_group(spdk_iscsi_parse_iscsi_configuration); } void