mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-05 18:05:16 +00:00
We don't need TAILQ for iSCSI PDUs; STAILQ is enough.
Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
67aa0eff2f
commit
16c158a562
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264109
@ -854,11 +854,11 @@ icl_conn_send_pdus(struct icl_conn *ic)
|
||||
available = sbspace(&so->so_snd);
|
||||
SOCKBUF_UNLOCK(&so->so_snd);
|
||||
|
||||
while (!TAILQ_EMPTY(&ic->ic_to_send)) {
|
||||
while (!STAILQ_EMPTY(&ic->ic_to_send)) {
|
||||
if (ic->ic_disconnecting)
|
||||
return;
|
||||
|
||||
request = TAILQ_FIRST(&ic->ic_to_send);
|
||||
request = STAILQ_FIRST(&ic->ic_to_send);
|
||||
size = icl_pdu_size(request);
|
||||
if (available < size) {
|
||||
/*
|
||||
@ -877,7 +877,7 @@ icl_conn_send_pdus(struct icl_conn *ic)
|
||||
return;
|
||||
}
|
||||
available -= size;
|
||||
TAILQ_REMOVE(&ic->ic_to_send, request, ip_next);
|
||||
STAILQ_REMOVE_HEAD(&ic->ic_to_send, ip_next);
|
||||
error = icl_pdu_send(request);
|
||||
if (error != 0) {
|
||||
ICL_DEBUG("failed to send PDU; "
|
||||
@ -977,7 +977,7 @@ icl_pdu_queue(struct icl_pdu *ip)
|
||||
icl_pdu_free(ip);
|
||||
return;
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&ic->ic_to_send, ip, ip_next);
|
||||
STAILQ_INSERT_TAIL(&ic->ic_to_send, ip, ip_next);
|
||||
cv_signal(&ic->ic_send_cv);
|
||||
}
|
||||
|
||||
@ -990,7 +990,7 @@ icl_conn_new(const char *name, struct mtx *lock)
|
||||
|
||||
ic = uma_zalloc(icl_conn_zone, M_WAITOK | M_ZERO);
|
||||
|
||||
TAILQ_INIT(&ic->ic_to_send);
|
||||
STAILQ_INIT(&ic->ic_to_send);
|
||||
ic->ic_lock = lock;
|
||||
cv_init(&ic->ic_send_cv, "icl_tx");
|
||||
cv_init(&ic->ic_receive_cv, "icl_rx");
|
||||
@ -1217,13 +1217,13 @@ icl_conn_close(struct icl_conn *ic)
|
||||
/*
|
||||
* Remove any outstanding PDUs from the send queue.
|
||||
*/
|
||||
while (!TAILQ_EMPTY(&ic->ic_to_send)) {
|
||||
pdu = TAILQ_FIRST(&ic->ic_to_send);
|
||||
TAILQ_REMOVE(&ic->ic_to_send, pdu, ip_next);
|
||||
while (!STAILQ_EMPTY(&ic->ic_to_send)) {
|
||||
pdu = STAILQ_FIRST(&ic->ic_to_send);
|
||||
STAILQ_REMOVE_HEAD(&ic->ic_to_send, ip_next);
|
||||
icl_pdu_free(pdu);
|
||||
}
|
||||
|
||||
KASSERT(TAILQ_EMPTY(&ic->ic_to_send),
|
||||
KASSERT(STAILQ_EMPTY(&ic->ic_to_send),
|
||||
("destroying session with non-empty send queue"));
|
||||
#ifdef DIAGNOSTIC
|
||||
KASSERT(ic->ic_outstanding_pdus == 0,
|
||||
|
@ -40,7 +40,7 @@
|
||||
struct icl_conn;
|
||||
|
||||
struct icl_pdu {
|
||||
TAILQ_ENTRY(icl_pdu) ip_next;
|
||||
STAILQ_ENTRY(icl_pdu) ip_next;
|
||||
struct icl_conn *ip_conn;
|
||||
struct iscsi_bhs *ip_bhs;
|
||||
struct mbuf *ip_bhs_mbuf;
|
||||
@ -79,7 +79,7 @@ struct icl_conn {
|
||||
#ifdef DIAGNOSTIC
|
||||
volatile u_int ic_outstanding_pdus;
|
||||
#endif
|
||||
TAILQ_HEAD(, icl_pdu) ic_to_send;
|
||||
STAILQ_HEAD(, icl_pdu) ic_to_send;
|
||||
size_t ic_receive_len;
|
||||
int ic_receive_state;
|
||||
struct icl_pdu *ic_receive_pdu;
|
||||
|
@ -217,12 +217,12 @@ iscsi_session_send_postponed(struct iscsi_session *is)
|
||||
|
||||
ISCSI_SESSION_LOCK_ASSERT(is);
|
||||
|
||||
while (!TAILQ_EMPTY(&is->is_postponed)) {
|
||||
request = TAILQ_FIRST(&is->is_postponed);
|
||||
while (!STAILQ_EMPTY(&is->is_postponed)) {
|
||||
request = STAILQ_FIRST(&is->is_postponed);
|
||||
postpone = iscsi_pdu_prepare(request);
|
||||
if (postpone)
|
||||
break;
|
||||
TAILQ_REMOVE(&is->is_postponed, request, ip_next);
|
||||
STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next);
|
||||
icl_pdu_queue(request);
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,7 @@ iscsi_pdu_queue_locked(struct icl_pdu *request)
|
||||
iscsi_session_send_postponed(is);
|
||||
postpone = iscsi_pdu_prepare(request);
|
||||
if (postpone) {
|
||||
TAILQ_INSERT_TAIL(&is->is_postponed, request, ip_next);
|
||||
STAILQ_INSERT_TAIL(&is->is_postponed, request, ip_next);
|
||||
return;
|
||||
}
|
||||
icl_pdu_queue(request);
|
||||
@ -326,9 +326,9 @@ iscsi_maintenance_thread_reconnect(struct iscsi_session *is)
|
||||
/*
|
||||
* Remove postponed PDUs.
|
||||
*/
|
||||
while (!TAILQ_EMPTY(&is->is_postponed)) {
|
||||
pdu = TAILQ_FIRST(&is->is_postponed);
|
||||
TAILQ_REMOVE(&is->is_postponed, pdu, ip_next);
|
||||
while (!STAILQ_EMPTY(&is->is_postponed)) {
|
||||
pdu = STAILQ_FIRST(&is->is_postponed);
|
||||
STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next);
|
||||
icl_pdu_free(pdu);
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ iscsi_maintenance_thread_reconnect(struct iscsi_session *is)
|
||||
|
||||
KASSERT(TAILQ_EMPTY(&is->is_outstanding),
|
||||
("destroying session with active tasks"));
|
||||
KASSERT(TAILQ_EMPTY(&is->is_postponed),
|
||||
KASSERT(STAILQ_EMPTY(&is->is_postponed),
|
||||
("destroying session with postponed PDUs"));
|
||||
|
||||
/*
|
||||
@ -395,9 +395,9 @@ iscsi_maintenance_thread_terminate(struct iscsi_session *is)
|
||||
/*
|
||||
* Remove postponed PDUs.
|
||||
*/
|
||||
while (!TAILQ_EMPTY(&is->is_postponed)) {
|
||||
pdu = TAILQ_FIRST(&is->is_postponed);
|
||||
TAILQ_REMOVE(&is->is_postponed, pdu, ip_next);
|
||||
while (!STAILQ_EMPTY(&is->is_postponed)) {
|
||||
pdu = STAILQ_FIRST(&is->is_postponed);
|
||||
STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next);
|
||||
icl_pdu_free(pdu);
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ iscsi_maintenance_thread_terminate(struct iscsi_session *is)
|
||||
|
||||
KASSERT(TAILQ_EMPTY(&is->is_outstanding),
|
||||
("destroying session with active tasks"));
|
||||
KASSERT(TAILQ_EMPTY(&is->is_postponed),
|
||||
KASSERT(STAILQ_EMPTY(&is->is_postponed),
|
||||
("destroying session with postponed PDUs"));
|
||||
|
||||
ISCSI_SESSION_UNLOCK(is);
|
||||
@ -458,7 +458,7 @@ iscsi_maintenance_thread(void *arg)
|
||||
ISCSI_SESSION_LOCK(is);
|
||||
if (is->is_reconnecting == false &&
|
||||
is->is_terminating == false &&
|
||||
TAILQ_EMPTY(&is->is_postponed))
|
||||
STAILQ_EMPTY(&is->is_postponed))
|
||||
cv_wait(&is->is_maintenance_cv, &is->is_lock);
|
||||
|
||||
if (is->is_reconnecting) {
|
||||
@ -636,7 +636,7 @@ iscsi_pdu_update_statsn(const struct icl_pdu *response)
|
||||
* Command window increased; kick the maintanance thread
|
||||
* to send out postponed commands.
|
||||
*/
|
||||
if (!TAILQ_EMPTY(&is->is_postponed))
|
||||
if (!STAILQ_EMPTY(&is->is_postponed))
|
||||
cv_signal(&is->is_maintenance_cv);
|
||||
} else if (maxcmdsn < is->is_maxcmdsn) {
|
||||
ISCSI_SESSION_DEBUG(is, "PDU MaxCmdSN %d < session MaxCmdSN %d; ignoring",
|
||||
@ -1646,7 +1646,7 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
|
||||
is->is_conn->ic_error = iscsi_error_callback;
|
||||
is->is_conn->ic_prv0 = is;
|
||||
TAILQ_INIT(&is->is_outstanding);
|
||||
TAILQ_INIT(&is->is_postponed);
|
||||
STAILQ_INIT(&is->is_postponed);
|
||||
mtx_init(&is->is_lock, "iscsi_lock", NULL, MTX_DEF);
|
||||
cv_init(&is->is_maintenance_cv, "iscsi_mt");
|
||||
#ifdef ICL_KERNEL_PROXY
|
||||
|
@ -69,7 +69,7 @@ struct iscsi_session {
|
||||
char is_target_alias[ISCSI_ALIAS_LEN];
|
||||
|
||||
TAILQ_HEAD(, iscsi_outstanding) is_outstanding;
|
||||
TAILQ_HEAD(, icl_pdu) is_postponed;
|
||||
STAILQ_HEAD(, icl_pdu) is_postponed;
|
||||
|
||||
struct callout is_callout;
|
||||
unsigned int is_timeout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user