From caf9e827e9ab4d1ea1569ab3c2000aeb3bde1053 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 28 Nov 2012 14:02:31 +0000 Subject: [PATCH] qla2x00t: Eliminate double req_q_cnt checks when there is enough headroom (merge r4135 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4632 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla2x00-target/qla2x00t.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 97865b581..e02e31011 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -2087,15 +2087,15 @@ static int q2t_check_reserve_free_req(scsi_qla_host_t *ha, uint32_t req_cnt) else ha->req_q_cnt = ha->request_q_length - (ha->req_ring_index - cnt); - } - if (unlikely(ha->req_q_cnt < (req_cnt + 2))) { - TRACE(TRACE_OUT_OF_MEM, "qla2x00t(%ld): There is no room in the " - "request ring: ha->req_ring_index=%d, ha->req_q_cnt=%d, " - "req_cnt=%d", ha->instance, ha->req_ring_index, - ha->req_q_cnt, req_cnt); - res = SCST_TGT_RES_QUEUE_FULL; - goto out; + if (unlikely(ha->req_q_cnt < (req_cnt + 2))) { + TRACE(TRACE_OUT_OF_MEM, "qla2x00t(%ld): There is no room in the " + "request ring: ha->req_ring_index=%d, ha->req_q_cnt=%d, " + "req_cnt=%d", ha->instance, ha->req_ring_index, + ha->req_q_cnt, req_cnt); + res = SCST_TGT_RES_QUEUE_FULL; + goto out; + } } ha->req_q_cnt -= req_cnt;