git: df3747c6607b - main - Replace STAILQ_SWAP() with simpler STAILQ_CONCAT().

Alexander Motin mav at FreeBSD.org
Tue Mar 2 23:48:54 UTC 2021


The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=df3747c6607be12d48db825653e6adfc3041e97f

commit df3747c6607be12d48db825653e6adfc3041e97f
Author:     Alexander Motin <mav at FreeBSD.org>
AuthorDate: 2021-03-02 23:39:44 +0000
Commit:     Alexander Motin <mav at FreeBSD.org>
CommitDate: 2021-03-02 23:48:49 +0000

    Replace STAILQ_SWAP() with simpler STAILQ_CONCAT().
    
    Also remove stray STAILQ_REMOVE_AFTER(), not causing problems only
    because STAILQ_SWAP() fixed corrupted stqh_last.
    
    MFC after:      1 week
---
 sys/dev/iscsi/icl_soft.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index c64f0cfde71b..d579c034e63f 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -933,7 +933,6 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue)
 				request2->ip_bhs_mbuf = NULL;
 				request->ip_bhs_mbuf->m_pkthdr.len += size2;
 				size += size2;
-				STAILQ_REMOVE_AFTER(queue, request, ip_next);
 				icl_soft_pdu_done(request2, 0);
 			}
 #if 0
@@ -972,13 +971,11 @@ icl_send_thread(void *arg)
 	for (;;) {
 		for (;;) {
 			/*
-			 * If the local queue is empty, populate it from
-			 * the main one.  This way the icl_conn_send_pdus()
-			 * can go through all the queued PDUs without holding
-			 * any locks.
+			 * Populate the local queue from the main one.
+			 * This way the icl_conn_send_pdus() can go through
+			 * all the queued PDUs without holding any locks.
 			 */
-			if (STAILQ_EMPTY(&queue))
-				STAILQ_SWAP(&ic->ic_to_send, &queue, icl_pdu);
+			STAILQ_CONCAT(&queue, &ic->ic_to_send);
 
 			ic->ic_check_send_space = false;
 			ICL_CONN_UNLOCK(ic);


More information about the dev-commits-src-main mailing list