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

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