iscsi: simplify spdk_iscsi_conn_stop_poller()

All calls to this function now use spdk_env_get_current_core()
as lcore, so remove this parameter.

All calls to this function also use _spdk_iscsi_conn_free() as
the stop_fn, so remove that parameter as well - just call that
function directly from the callsites and eliminate the extra
event.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I639e63d26fbfcc054137d9b453be2927e2c1f625

Reviewed-on: https://review.gerrithub.io/395854
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2018-01-22 12:53:51 -07:00 committed by Daniel Verkamp
parent 5aa90453cb
commit 20528e262d

View File

@ -79,8 +79,7 @@ void spdk_iscsi_conn_login_do_work(void *arg);
void spdk_iscsi_conn_full_feature_do_work(void *arg);
static void spdk_iscsi_conn_full_feature_migrate(void *arg1, void *arg2);
static void spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn, spdk_event_fn fn_after_stop,
int lcore);
static void spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn);
static struct spdk_iscsi_conn *
allocate_conn(void)
@ -653,10 +652,8 @@ spdk_iscsi_conn_cleanup_backend(struct spdk_iscsi_conn *conn)
}
static void
_spdk_iscsi_conn_free(void *arg1, void *arg2)
_spdk_iscsi_conn_free(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_conn *conn = arg1;
pthread_mutex_lock(&g_conns_mutex);
spdk_iscsi_remove_conn(conn);
pthread_mutex_unlock(&g_conns_mutex);
@ -675,7 +672,8 @@ _spdk_iscsi_conn_check_shutdown(void *arg)
spdk_poller_unregister(&conn->shutdown_timer);
spdk_iscsi_conn_stop_poller(conn, _spdk_iscsi_conn_free, spdk_env_get_current_core());
spdk_iscsi_conn_stop_poller(conn);
_spdk_iscsi_conn_free(conn);
}
void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
@ -701,7 +699,8 @@ void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
/* The connection cannot be freed yet. Check back later. */
conn->shutdown_timer = spdk_poller_register(_spdk_iscsi_conn_check_shutdown, conn, 1000);
} else {
spdk_iscsi_conn_stop_poller(conn, _spdk_iscsi_conn_free, spdk_env_get_current_core());
spdk_iscsi_conn_stop_poller(conn);
_spdk_iscsi_conn_free(conn);
}
}
@ -754,13 +753,11 @@ spdk_iscsi_conn_check_shutdown(void *arg)
}
/**
* This function will stop the poller for the specified connection, and then call function
* fn_after_stop() on the specified lcore.
* This function will stop the poller for the specified connection.
*/
static void
spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn, spdk_event_fn fn_after_stop, int lcore)
spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn)
{
struct spdk_event *event;
struct spdk_iscsi_tgt_node *target;
if (conn->sess != NULL && conn->sess->session_type == SESSION_TYPE_NORMAL &&
@ -776,8 +773,6 @@ spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn, spdk_event_fn fn_after
__sync_fetch_and_sub(&g_num_connections[spdk_env_get_current_core()], 1);
spdk_net_framework_clear_socket_association(conn->sock);
spdk_poller_unregister(&conn->poller);
event = spdk_event_allocate(lcore, fn_after_stop, conn, NULL);
spdk_event_call(event);
}
void spdk_shutdown_iscsi_conns(void)