Skip to content

Commit 982cc4b

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: qla2xxx: Use an on-stack completion in qla24xx_control_vp()
This patch reduces the size of struct srb. Cc: Himanshu Madhani <[email protected]> Cc: Giridhar Malavali <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Acked-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 1956eee commit 982cc4b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ typedef struct srb {
545545
u32 gen2; /* scratch */
546546
int rc;
547547
int retry_count;
548-
struct completion comp;
548+
struct completion *comp;
549549
wait_queue_head_t *cwaitq;
550550
union {
551551
struct srb_iocb iocb_cmd;

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2570,7 +2570,6 @@ void qla2x00_init_timer(srb_t *sp, unsigned long tmo)
25702570
timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0);
25712571
sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;
25722572
sp->free = qla2x00_sp_free;
2573-
init_completion(&sp->comp);
25742573
if (IS_QLAFX00(sp->vha->hw) && sp->type == SRB_FXIOCB_DCMD)
25752574
init_completion(&sp->u.iocb_cmd.u.fxiocb.fxiocb_comp);
25762575
add_timer(&sp->u.iocb_cmd.timer);

drivers/scsi/qla2xxx/qla_mid.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,8 @@ static void qla_ctrlvp_sp_done(void *s, int res)
905905
{
906906
struct srb *sp = s;
907907

908-
complete(&sp->comp);
908+
if (sp->comp)
909+
complete(sp->comp);
909910
/* don't free sp here. Let the caller do the free */
910911
}
911912

@@ -922,6 +923,7 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
922923
struct qla_hw_data *ha = vha->hw;
923924
int vp_index = vha->vp_idx;
924925
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
926+
DECLARE_COMPLETION_ONSTACK(comp);
925927
srb_t *sp;
926928

927929
ql_dbg(ql_dbg_vport, vha, 0x10c1,
@@ -936,6 +938,7 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
936938

937939
sp->type = SRB_CTRL_VP;
938940
sp->name = "ctrl_vp";
941+
sp->comp = &comp;
939942
sp->done = qla_ctrlvp_sp_done;
940943
sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout;
941944
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2);
@@ -953,7 +956,9 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)
953956
ql_dbg(ql_dbg_vport, vha, 0x113f, "%s hndl %x submitted\n",
954957
sp->name, sp->handle);
955958

956-
wait_for_completion(&sp->comp);
959+
wait_for_completion(&comp);
960+
sp->comp = NULL;
961+
957962
rval = sp->rc;
958963
switch (rval) {
959964
case QLA_FUNCTION_TIMEOUT:

0 commit comments

Comments
 (0)