Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Apr 2014 08:43:24 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264109 - head/sys/dev/iscsi
Message-ID:  <201404040843.s348hO79082078@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Fri Apr  4 08:43:23 2014
New Revision: 264109
URL: http://svnweb.freebsd.org/changeset/base/264109

Log:
  We don't need TAILQ for iSCSI PDUs; STAILQ is enough.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/icl.c
  head/sys/dev/iscsi/icl.h
  head/sys/dev/iscsi/iscsi.c
  head/sys/dev/iscsi/iscsi.h

Modified: head/sys/dev/iscsi/icl.c
==============================================================================
--- head/sys/dev/iscsi/icl.c	Fri Apr  4 07:43:11 2014	(r264108)
+++ head/sys/dev/iscsi/icl.c	Fri Apr  4 08:43:23 2014	(r264109)
@@ -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 mt
 
 	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,

Modified: head/sys/dev/iscsi/icl.h
==============================================================================
--- head/sys/dev/iscsi/icl.h	Fri Apr  4 07:43:11 2014	(r264108)
+++ head/sys/dev/iscsi/icl.h	Fri Apr  4 08:43:23 2014	(r264109)
@@ -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;

Modified: head/sys/dev/iscsi/iscsi.c
==============================================================================
--- head/sys/dev/iscsi/iscsi.c	Fri Apr  4 07:43:11 2014	(r264108)
+++ head/sys/dev/iscsi/iscsi.c	Fri Apr  4 08:43:23 2014	(r264109)
@@ -217,12 +217,12 @@ iscsi_session_send_postponed(struct iscs
 
 	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 *r
 	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(struc
 	/*
 	 * 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(struc
 
 	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(struc
 	/*
 	 * 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(struc
 
 	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
 			 * 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_sof
 	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

Modified: head/sys/dev/iscsi/iscsi.h
==============================================================================
--- head/sys/dev/iscsi/iscsi.h	Fri Apr  4 07:43:11 2014	(r264108)
+++ head/sys/dev/iscsi/iscsi.h	Fri Apr  4 08:43:23 2014	(r264109)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404040843.s348hO79082078>