[openib-general] [PATCH] iser: use host->host_lock instead of conn->lock

Or Gerlitz ogerlitz at voltaire.com
Mon Jan 16 23:13:51 PST 2006


applied to r5032

moved to use host->host_lock instead of conn->lock in conn_destroy,
removed conn->lock and conn->max_outstanding_cmds

Signed-off-by: Or Gerlitz  <ogerlitz at voltaire.com>
Signed-off-by: Erez Zilber <erezz at voltaire.com>

Index: ulp/iser/iscsi_iser.h
===================================================================
--- ulp/iser/iscsi_iser.h	(revision 5024)
+++ ulp/iser/iscsi_iser.h	(working copy)
@@ -198,11 +198,9 @@ struct iscsi_iser_conn
 
 	uint32_t		exp_statsn;
 	int			id;		/* iSCSI CID */
-	spinlock_t		lock;	     /* MERGE_FIXME: can it be removed */
 
 	int max_recv_dlength;	/* == initiator_max_recv_dsl  */
 	int max_xmit_dlength;   /* == target_max_recv_dsl     */
-	unsigned int 		max_outstand_cmds; /*  MERGE_FIXME need2 review */
 
 	/* abort */
 	wait_queue_head_t	ehwait;		/* used in eh_abort()     */
Index: ulp/iser/iscsi_iser.c
===================================================================
--- ulp/iser/iscsi_iser.c	(revision 5024)
+++ ulp/iser/iscsi_iser.c	(working copy)
@@ -643,12 +643,10 @@ static inline void iscsi_iser_ctask_clea
 	}
 	if (sc->sc_data_direction == DMA_TO_DEVICE) {
 		struct iscsi_iser_data_task *dtask, *n;
-		spin_lock(&conn->lock);
 		list_for_each_entry_safe(dtask, n, &ctask->dataqueue, item) {
 			list_del(&dtask->item);
 			mempool_free(dtask, ctask->datapool);
 		}
-		spin_unlock(&conn->lock);
 	}
 
 	ctask->sc = NULL;
@@ -1116,8 +1114,6 @@ static iscsi_connh_t iscsi_iser_conn_cre
 
 	conn->exp_statsn = 0;
 
-	spin_lock_init(&conn->lock);
-
 	/* initialize general xmit PDU commands queue */
 	conn->xmitqueue = kfifo_alloc(session->cmds_max * sizeof(void*),
 				      GFP_KERNEL, NULL);
@@ -1231,6 +1227,7 @@ static void iscsi_iser_conn_destroy(iscs
 {
 	struct iscsi_iser_conn *conn = iscsi_ptr(connh);
 	struct iscsi_iser_session *session = conn->session;
+	unsigned long flags;
 
 	debug_iser("%s: enter\n", __FUNCTION__);
 
@@ -1260,13 +1257,13 @@ static void iscsi_iser_conn_destroy(iscs
 	 * time out or fail.
 	 */
 	for (;;) {
-		spin_lock_bh(&conn->lock);
+		spin_lock_irqsave(session->host->host_lock, flags);
 		if (!session->host->host_busy) { /* OK for ERL == 0 */
-			spin_unlock_bh(&conn->lock);
-			debug_iser("%s: released conn->lock (host's not busy)\n", __FUNCTION__);
+			spin_unlock_irqrestore(session->host->host_lock, flags);
+			debug_iser("%s: released host_lock (host's not busy)\n", __FUNCTION__);
 			break;
 		}
-		spin_unlock_bh(&conn->lock);
+		spin_unlock_irqrestore(session->host->host_lock, flags);
 		msleep_interruptible(500);
 		debug_iser("conn_destroy(): host = 0x%p, host_busy %d host_failed %d\n", session->host,
 			   session->host->host_busy, session->host->host_failed);




More information about the general mailing list