Skip to content

Commit

Permalink
[SCSI] qla2xxx: Micro optimization in queuecommand handler
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Chetan Loke <loke.chetan@gmail.com>
Reviewed-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Reviewed-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Chetan Loke authored and James Bottomley committed May 22, 2012
1 parent 9e33652 commit a6eb3c9
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions drivers/scsi/qla2xxx/qla_iocb.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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). */
Expand Down Expand Up @@ -2343,11 +2343,10 @@ qla82xx_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;

ctx = sp->u.scmd.ctx =
mempool_alloc(ha->ctx_mempool, GFP_ATOMIC);
if (!ctx) {
Expand Down

0 comments on commit a6eb3c9

Please sign in to comment.