From 154760a00e657fdd2cc70669602dad71cdb41724 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Thu, 6 Dec 2012 10:34:54 +0100 Subject: [PATCH] RECONNECT remove redundant requeue code We first merge waitpdu and outqueue queues and then requeue the elements. iscsi_add_to_outqueue() will sort them accordingly so this is no problem. Signed-off-by: Peter Lieven --- lib/connect.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index 0275b17..da3b5d8 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -288,6 +288,12 @@ try_again: goto try_again; } + while (old_iscsi->outqueue) { + struct iscsi_pdu *pdu = old_iscsi->outqueue; + SLIST_REMOVE(&old_iscsi->outqueue, pdu); + SLIST_ADD_END(&old_iscsi->waitpdu, pdu); + } + while (old_iscsi->waitpdu) { struct iscsi_pdu *pdu = old_iscsi->waitpdu; @@ -296,30 +302,6 @@ try_again: continue; } - pdu->itt = iscsi_itt_post_increment(iscsi); - iscsi_pdu_set_itt(pdu, pdu->itt); - - /* do not increase cmdsn for PDUs marked for immediate delivery - * this will result in a protocol error */ - pdu->cmdsn = (pdu->outdata.data[0] & ISCSI_PDU_IMMEDIATE)?iscsi->cmdsn:iscsi->cmdsn++; - iscsi_pdu_set_cmdsn(pdu, pdu->cmdsn); - - iscsi_pdu_set_expstatsn(pdu, iscsi->statsn); - iscsi->statsn++; - - pdu->written = 0; - pdu->out_written = 0; - iscsi_add_to_outqueue(iscsi, pdu); - } - - while (old_iscsi->outqueue) { - struct iscsi_pdu *pdu = old_iscsi->outqueue; - - SLIST_REMOVE(&old_iscsi->outqueue, pdu); - if (pdu->itt == 0xffffffff) { - continue; - } - if (pdu->flags & ISCSI_PDU_DROP_ON_RECONNECT) { /* We dont want to requeue things like DATA-OUT since these guys * will be reissued automatically anyway once the corresponding