Skip to contentSkip to conversation

qla2xxx: Micro optimization in queuecommand handler

PATCH In review Chetan Loke 3 participants 4 messages Feb 14, 2012 – Feb 22, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qla2xxx: Micro optimization in queuecommand handler

Optimized queuecommand handler's to eliminate double head-room checks.
The checks are moved inside the 1st if-loop otherwise you would end up checking twice when there is enough head room.

---
 drivers/scsi/qla2xxx/qla_iocb.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +9 -10
index 55a9676..825a046 100644
@@ -383,9 +383,10 @@ qla2x00_start_scsi(srb_t *sp)
 		else
 			req->cnt = req->length -
 			    (req->ring_index - cnt);
+		/* If still no head room then bail out */
+		if (req->cnt < (req_cnt + 2))
+			goto queuing_error;
 	}
-	if (req->cnt < (req_cnt + 2))
-		goto queuing_error;
 
 	/* Build command packet */
 	req->current_outstanding_cmd = handle;
@@ -1502,9 +1503,9 @@ qla24xx_start_scsi(srb_t *sp)
 		else
 			req->cnt = req->length -
 				(req->ring_index - cnt);
+		if (req->cnt < (req_cnt + 2))
+			goto queuing_error;
 	}
-	if (req->cnt < (req_cnt + 2))
-		goto queuing_error;
 
 	/* Build command packet. */
 	req->current_outstanding_cmd = handle;
@@ -1717,11 +1718,10 @@ qla24xx_dif_start_scsi(srb_t *sp)
 		else
 			req->cnt = req->length -
 				(req->ring_index - cnt);
+		if (req->cnt < (req_cnt + 2))
+			goto queuing_error;
 	}
 
-	if (req->cnt < (req_cnt + 2))
-		goto queuing_error;
-
 	status |= QDSS_GOT_Q_SPACE;
 
 	/* Build header part of command packet (excluding the OPCODE). */
@@ -2349,11 +2349,10 @@ sufficient_dsds:
 			else
 				req->cnt = req->length -
 					(req->ring_index - cnt);
+			if (req->cnt < (req_cnt + 2))
+				goto queuing_error;
 		}
 
-		if (req->cnt < (req_cnt + 2))
-			goto queuing_error;
-
 		ctx = sp->ctx = mempool_alloc(ha->ctx_mempool, GFP_ATOMIC);
 		if (!sp->ctx) {
 			ql_log(ql_log_fatal, vha, 0x3010,
Signature · 1 line
1.7.5.2
#1 lore raw
Quoted 9 lines

From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Chetan Loke
Sent: February 14, 2012 9:48 AM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH 1/1] qla2xxx: Micro optimization in queuecommand handler

Quoted 6 lines

Optimized queuecommand handler's to eliminate double head-room checks. The checks are moved inside the 1st if-loop otherwise you would end up checking twice when there is enough head room.

---

Ping...

Quoted 37 lines
 drivers/scsi/qla2xxx/qla_iocb.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +5 -4
index 55a9676..825a046 100644
@@ -383,9 +383,10 @@ qla2x00_start_scsi(srb_t *sp)
 		else
 			req->cnt = req->length -
 			    (req->ring_index - cnt);
+		/* If still no head room then bail out */
+		if (req->cnt < (req_cnt + 2))
+			goto queuing_error;
 	}
-	if (req->cnt < (req_cnt + 2))
-		goto queuing_error;
 
 	/* Build command packet */
 	req->current_outstanding_cmd = handle;
@@ -1502,9 +1503,9 @@ qla24xx_start_scsi(srb_t *sp)
 		else
 			req->cnt = req->length -
 				(req->ring_index - cnt);
+		if (req->cnt < (req_cnt + 2))
+			goto queuing_error;
 	}
-	if (req->cnt < (req_cnt + 2))
-		goto queuing_error;
 
 	/* Build command packet. */
 	req->current_outstanding_cmd = handle;
@@ -1717,11 +1718,10 @@ qla24xx_dif_start_scsi(srb_t *sp)
 		else
 			req->cnt = req->length -
 				(req->ring_index - cnt);

drivers/scsi/qla2xxx/qla_iocb.c qla24xx_dif_start_scsi(srb_t *sp) · line 1727

Quoted 10 lines
drivers/scsi/qla2xxx/qla_iocb.c +2 -3
+		if (req->cnt < (req_cnt + 2))
+			goto queuing_error;
 	}
 
-	if (req->cnt < (req_cnt + 2))
-		goto queuing_error;
-
 	status |= QDSS_GOT_Q_SPACE;
 
 	/* Build header part of command packet (excluding the OPCODE).

*/

drivers/scsi/qla2xxx/qla_iocb.c sufficient_dsds: · line 2356

Quoted 12 lines
drivers/scsi/qla2xxx/qla_iocb.c +2 -3
@@ -2349,11 +2349,10 @@ sufficient_dsds:
 			else
 				req->cnt = req->length -
 					(req->ring_index - cnt);
+			if (req->cnt < (req_cnt + 2))
+				goto queuing_error;
 		}
 
-		if (req->cnt < (req_cnt + 2))
-			goto queuing_error;
-
 		ctx = sp->ctx = mempool_alloc(ha->ctx_mempool,

GFP_ATOMIC);

Quoted 10 lines
drivers/scsi/qla2xxx/qla_iocb.c +0 -1
 		if (!sp->ctx) {
 			ql_log(ql_log_fatal, vha, 0x3010,
--

1.7.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 9 lines · Chetan
Quoted 9 lines

From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Chetan Loke
Sent: February 14, 2012 9:48 AM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH 1/1] qla2xxx: Micro optimization in queuecommand handler

Quoted 9 lines
Quoted 6 lines

Optimized queuecommand handler's to eliminate double head-room checks. The checks are moved inside the 1st if-loop otherwise you would end up checking twice when there is enough head room.

---

Ping...

Hi Chetan,

We have picked this up and it will be part of our next submission. Since this affects the I/O path we wanted to have this patch go through one of our full test cycles.

Thanks,
Chad

Quoted 75 lines
Quoted 41 lines



 drivers/scsi/qla2xxx/qla_iocb.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +5 -4
index 55a9676..825a046 100644
@@ -383,9 +383,10 @@ qla2x00_start_scsi(srb_t *sp)
             else
                     req->cnt = req->length -
                         (req->ring_index - cnt);
+            /* If still no head room then bail out */
+            if (req->cnt < (req_cnt + 2))
+                    goto queuing_error;
     }
-    if (req->cnt < (req_cnt + 2))
-            goto queuing_error;
 
     /* Build command packet */
     req->current_outstanding_cmd = handle;
@@ -1502,9 +1503,9 @@ qla24xx_start_scsi(srb_t *sp)
             else
                     req->cnt = req->length -
                             (req->ring_index - cnt);
+            if (req->cnt < (req_cnt + 2))
+                    goto queuing_error;
     }
-    if (req->cnt < (req_cnt + 2))
-            goto queuing_error;
 
     /* Build command packet. */
     req->current_outstanding_cmd = handle;
@@ -1717,11 +1718,10 @@ qla24xx_dif_start_scsi(srb_t *sp)
             else
                     req->cnt = req->length -
                             (req->ring_index - cnt);

drivers/scsi/qla2xxx/qla_iocb.c qla24xx_dif_start_scsi(srb_t *sp) · line 1727

Quoted 10 lines
drivers/scsi/qla2xxx/qla_iocb.c +2 -3
+            if (req->cnt < (req_cnt + 2))
+                    goto queuing_error;
     }
 
-    if (req->cnt < (req_cnt + 2))
-            goto queuing_error;
-
     status |= QDSS_GOT_Q_SPACE;
 
     /* Build header part of command packet (excluding the OPCODE).

*/

drivers/scsi/qla2xxx/qla_iocb.c sufficient_dsds: · line 2356

Quoted 12 lines
drivers/scsi/qla2xxx/qla_iocb.c +2 -3
@@ -2349,11 +2349,10 @@ sufficient_dsds:
                     else
                             req->cnt = req->length -
                                     (req->ring_index - cnt);
+                    if (req->cnt < (req_cnt + 2))
+                            goto queuing_error;
             }
 
-            if (req->cnt < (req_cnt + 2))
-                    goto queuing_error;
-
             ctx = sp->ctx = mempool_alloc(ha->ctx_mempool,

GFP_ATOMIC);

Quoted 10 lines
drivers/scsi/qla2xxx/qla_iocb.c +0 -1
             if (!sp->ctx) {
                     ql_log(ql_log_fatal, vha, 0x3010,
--

1.7.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

#3 lore raw
Quoted 9 lines

From: Chad Dupuis [mailto:[email protected]]
Sent: February 22, 2012 1:49 PM
To: Loke, Chetan
Cc: [email protected]; [email protected]; Andrew Vasquez; Dept-Eng Linux Driver; [email protected]
Subject: RE: [PATCH 1/1] qla2xxx: Micro optimization in queuecommand handler

.......

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Optimized queuecommand handler's to eliminate double head-room

checks.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The checks are moved inside the 1st if-loop otherwise you would end

up

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

checking twice when there is enough head room.

---

Quoted 7 lines
Quoted 2 lines

Ping...

Hi Chetan,

We have picked this up and it will be part of our next submission. Since this affects the I/O path we wanted to have this patch go

through one

Quoted 2 lines

of our full test cycles.

No problem. Thanks for the update Chad.

Quoted 2 lines

Thanks,
Chad

Chetan