From cfd10f094a0b2bd21d110009a83b5f46d9514fcd Mon Sep 17 00:00:00 2001 From: Himanshu Madhani Date: Thu, 1 Aug 2019 15:55:54 -0400 Subject: [PATCH 094/124] [scsi] scsi: qla2xxx: Use an on-stack completion in qla24xx_control_vp() Message-id: <20190801155618.12650-95-hmadhani@redhat.com> Patchwork-id: 267884 O-Subject: [RHEL 7.8 e-stor PATCH 094/118] scsi: qla2xxx: Use an on-stack completion in qla24xx_control_vp() Bugzilla: 1729270 RH-Acked-by: Jarod Wilson RH-Acked-by: Tony Camuso From: Bart Van Assche Bugzilla 1729270 This patch reduces the size of struct srb. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani Signed-off-by: Martin K. Petersen (cherry picked from commit 982cc4be05d6d0d8b15b1340416737ad60bddcae) Signed-off-by: Himanshu Madhani Conflicts: drivers/scsi/qla2xxx/qla_def.h drivers/scsi/qla2xxx/qla_iocb.c [ HM: Since RHEL78 code does not include commit ID 12975426d888 ] [ ("scsi: qla2xxx: Uninline qla2x00_init_timer()") qla_iocb.c does ] [ not include qla2x00_init_timer(). So init_completion() is removed ] [ from qla_inline.h ] Signed-off-by: Himanshu Madhani Signed-off-by: Jan Stancek --- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_inline.h | 1 - drivers/scsi/qla2xxx/qla_mid.c | 9 +++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 8ad107855ea1..e5e1081501a9 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -555,7 +555,7 @@ typedef struct srb { u32 gen2; /* scratch */ int rc; int retry_count; - struct completion comp; + struct completion *comp; union { struct srb_iocb iocb_cmd; struct fc_bsg_job *bsg_job; diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index a3bd72ad0def..03fd0288ac03 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -227,7 +227,6 @@ qla2x00_init_timer(srb_t *sp, unsigned long tmo) sp->u.iocb_cmd.timer.data = (unsigned long)sp; sp->u.iocb_cmd.timer.function = qla2x00_sp_timeout; sp->free = qla2x00_sp_free; - init_completion(&sp->comp); if (IS_QLAFX00(sp->vha->hw) && (sp->type == SRB_FXIOCB_DCMD)) init_completion(&sp->u.iocb_cmd.u.fxiocb.fxiocb_comp); add_timer(&sp->u.iocb_cmd.timer); diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index c5f367fae270..203188563735 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -904,7 +904,8 @@ static void qla_ctrlvp_sp_done(void *s, int res) { struct srb *sp = s; - complete(&sp->comp); + if (sp->comp) + complete(sp->comp); /* don't free sp here. Let the caller do the free */ } @@ -921,6 +922,7 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) struct qla_hw_data *ha = vha->hw; int vp_index = vha->vp_idx; struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); + DECLARE_COMPLETION_ONSTACK(comp); srb_t *sp; ql_dbg(ql_dbg_vport, vha, 0x10c1, @@ -935,6 +937,7 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) sp->type = SRB_CTRL_VP; sp->name = "ctrl_vp"; + sp->comp = ∁ sp->done = qla_ctrlvp_sp_done; sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); @@ -952,7 +955,9 @@ int qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) ql_dbg(ql_dbg_vport, vha, 0x113f, "%s hndl %x submitted\n", sp->name, sp->handle); - wait_for_completion(&sp->comp); + wait_for_completion(&comp); + sp->comp = NULL; + rval = sp->rc; switch (rval) { case QLA_FUNCTION_TIMEOUT: -- 2.13.6