iscsi: use temporary poller when PDUs cannot all be flushed
This removes PDU flushing from the main connection poller - all PDU flushing is now done inline when the PDU is completed, or from the context of the new flush poller. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I703cb451d4b548e7f75892e31a7927b511fb4f55 Reviewed-on: https://review.gerrithub.io/395543 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
This commit is contained in:
parent
a1bbed818e
commit
89859d3118
@ -693,6 +693,7 @@ void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
|
||||
spdk_clear_all_transfer_task(conn, NULL);
|
||||
spdk_sock_close(conn->sock);
|
||||
spdk_poller_unregister(&conn->logout_timer);
|
||||
spdk_poller_unregister(&conn->flush_poller);
|
||||
|
||||
rc = spdk_iscsi_conn_free_tasks(conn);
|
||||
if (rc < 0) {
|
||||
@ -1218,13 +1219,19 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
|
||||
* Returns -1 for an exceptional error indicating the TCP connection
|
||||
* should be closed.
|
||||
*/
|
||||
static int
|
||||
spdk_iscsi_conn_flush_pdus(struct spdk_iscsi_conn *conn)
|
||||
static void
|
||||
spdk_iscsi_conn_flush_pdus(void *_conn)
|
||||
{
|
||||
struct spdk_iscsi_conn *conn = _conn;
|
||||
int rc;
|
||||
|
||||
if (conn->state == ISCSI_CONN_STATE_RUNNING) {
|
||||
rc = spdk_iscsi_conn_flush_pdus_internal(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);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* If the connection state is not RUNNING, then
|
||||
@ -1237,16 +1244,6 @@ spdk_iscsi_conn_flush_pdus(struct spdk_iscsi_conn *conn)
|
||||
} while (rc == 1);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
{
|
||||
int rc;
|
||||
|
||||
TAILQ_INSERT_TAIL(&conn->write_pdu_list, pdu, tailq);
|
||||
rc = spdk_iscsi_conn_flush_pdus(conn);
|
||||
if (rc < 0 && conn->state < ISCSI_CONN_STATE_EXITING) {
|
||||
/*
|
||||
* If the poller has already started destruction of the connection,
|
||||
@ -1257,6 +1254,13 @@ spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *p
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
spdk_iscsi_conn_write_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
{
|
||||
TAILQ_INSERT_TAIL(&conn->write_pdu_list, pdu, tailq);
|
||||
spdk_iscsi_conn_flush_pdus(conn);
|
||||
}
|
||||
|
||||
#define GET_PDU_LOOP_COUNT 16
|
||||
|
||||
static int
|
||||
@ -1323,11 +1327,6 @@ spdk_iscsi_conn_execute(struct spdk_iscsi_conn *conn)
|
||||
conn_active = true;
|
||||
}
|
||||
|
||||
if (spdk_iscsi_conn_flush_pdus(conn) < 0) {
|
||||
conn->state = ISCSI_CONN_STATE_EXITING;
|
||||
goto conn_exit;
|
||||
}
|
||||
|
||||
spdk_iscsi_conn_handle_queued_datain_tasks(conn);
|
||||
|
||||
if (conn_active) {
|
||||
|
@ -160,6 +160,7 @@ struct spdk_iscsi_conn {
|
||||
|
||||
STAILQ_ENTRY(spdk_iscsi_conn) link;
|
||||
struct spdk_poller *poller;
|
||||
struct spdk_poller *flush_poller;
|
||||
TAILQ_HEAD(queued_r2t_tasks, spdk_iscsi_task) queued_r2t_tasks;
|
||||
TAILQ_HEAD(active_r2t_tasks, spdk_iscsi_task) active_r2t_tasks;
|
||||
TAILQ_HEAD(queued_datain_tasks, spdk_iscsi_task) queued_datain_tasks;
|
||||
|
Loading…
Reference in New Issue
Block a user