Blame SOURCES/0094-scsi-scsi-qla2xxx-Use-an-on-stack-completion-in-qla2.patch

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