iscsi: Add meaningful return code to pollers

Some poller's return code don't match comments or are always -1.
We will be able to add more meaningful return code and contribute
to improve SPDK statistics.

Change-Id: Ia3eda31a32a3a76bc75c9860cc32cb86ce588904
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/436228
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-12-06 08:19:32 +09:00 committed by Jim Harris
parent 308b62c6ba
commit 193ecb2c4b
2 changed files with 17 additions and 22 deletions

View File

@ -512,7 +512,7 @@ _spdk_iscsi_conn_check_shutdown(void *arg)
rc = spdk_iscsi_conn_free_tasks(conn);
if (rc < 0) {
return -1;
return 1;
}
spdk_poller_unregister(&conn->shutdown_timer);
@ -520,7 +520,7 @@ _spdk_iscsi_conn_check_shutdown(void *arg)
spdk_iscsi_conn_stop(conn);
_spdk_iscsi_conn_free(conn);
return -1;
return 1;
}
static void
@ -550,14 +550,14 @@ _spdk_iscsi_conn_check_pending_tasks(void *arg)
struct spdk_iscsi_conn *conn = arg;
if (conn->dev != NULL && spdk_scsi_dev_has_pending_tasks(conn->dev)) {
return -1;
return 1;
}
spdk_poller_unregister(&conn->shutdown_timer);
_spdk_iscsi_conn_destruct(conn);
return -1;
return 1;
}
void
@ -620,14 +620,16 @@ spdk_iscsi_conn_check_shutdown(void *arg)
{
struct spdk_event *event;
if (spdk_iscsi_get_active_conns() == 0) {
if (spdk_iscsi_get_active_conns() != 0) {
return 1;
}
spdk_poller_unregister(&g_shutdown_timer);
event = spdk_event_allocate(spdk_env_get_current_core(),
spdk_iscsi_conn_check_shutdown_cb, NULL, NULL);
spdk_event_call(event);
}
return -1;
return 1;
}
static void
@ -1218,14 +1220,6 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
*
* During other connection states (EXITING or LOGGED_OUT), this
* function will spin until all PDUs have successfully been flushed.
*
* Returns 0 for success and when all PDUs were able to be flushed.
*
* Returns 1 for success but when some PDUs could not be flushed due
* to lack of TCP buffer space.
*
* Returns -1 for an exceptional error indicating the TCP connection
* should be closed.
*/
static int
spdk_iscsi_conn_flush_pdus(void *_conn)
@ -1238,7 +1232,8 @@ spdk_iscsi_conn_flush_pdus(void *_conn)
if (rc == 0 && conn->flush_poller != NULL) {
spdk_poller_unregister(&conn->flush_poller);
} else if (rc == 1 && conn->flush_poller == NULL) {
conn->flush_poller = spdk_poller_register(spdk_iscsi_conn_flush_pdus, conn, 50);
conn->flush_poller = spdk_poller_register(spdk_iscsi_conn_flush_pdus,
conn, 50);
}
} else {
/*
@ -1261,7 +1256,7 @@ spdk_iscsi_conn_flush_pdus(void *_conn)
conn->state = ISCSI_CONN_STATE_EXITING;
}
return -1;
return 1;
}
void

View File

@ -3263,7 +3263,7 @@ _spdk_iscsi_op_abort_task(void *arg)
rc = spdk_iscsi_conn_abort_queued_datain_task(task->conn,
task->scsi.abort_id);
if (rc != 0) {
return 0;
return 1;
}
spdk_poller_unregister(&task->mgmt_poller);
@ -3288,7 +3288,7 @@ _spdk_iscsi_op_abort_task_set(void *arg)
rc = spdk_iscsi_conn_abort_queued_datain_tasks(task->conn, task->scsi.lun,
task->pdu);
if (rc != 0) {
return 0;
return 1;
}
spdk_poller_unregister(&task->mgmt_poller);