From: Chetan Loke Date: Thu, 16 Feb 2012 19:34:56 +0000 (-0600) Subject: qla2xxx: Micro optimization in queuecommand handler X-Git-Tag: v2.6.39-400.9.0~477 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=239e8173812e37e9c1cbca89cea0c458702e0896;p=users%2Fjedix%2Flinux-maple.git 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. JIRA Key: V2632FC-172 --- diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index e015bb7af23d..83547e0cdbc1 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -384,9 +384,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; @@ -1499,9 +1500,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; @@ -1714,11 +1715,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). */ @@ -2341,11 +2341,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->u.scmd.ctx = mempool_alloc(ha->ctx_mempool, GFP_ATOMIC); if (!ctx) {