From patchwork Wed Apr 17 21:44:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10906249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C512B1390 for ; Wed, 17 Apr 2019 21:45:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0C5C28A93 for ; Wed, 17 Apr 2019 21:45:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4E4628BA9; Wed, 17 Apr 2019 21:45:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 431FC28A93 for ; Wed, 17 Apr 2019 21:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387936AbfDQVpZ (ORCPT ); Wed, 17 Apr 2019 17:45:25 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:34352 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387941AbfDQVpZ (ORCPT ); Wed, 17 Apr 2019 17:45:25 -0400 Received: by mail-pf1-f195.google.com with SMTP id b3so90507pfd.1 for ; Wed, 17 Apr 2019 14:45:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GIpobrlfPJwI22wRVOJtPkh5AvQSRQEkpL4S7hL4XRY=; b=LFDfast4wccwmvzZ/52VfbSpQirgwPGB6FJXqP9uVddAoOzScVcg+YlaE61qmiwF2J OPwMhsurrm2ZZb7lL1xtmvTebN6y6lkokj9zl7dscp069rKB45HTuQPH9rUA42/HboOs +uGCKitPqWcBJJgDXHK08w3QwYoScRHNlhzE0tlosf1+Rqe5tSU+scGYbs6uA8nV/YUh p17iOOXCeyVinQn6iWGEH0Vt5BTd9P4a0MfZNgxM4pIzeDtUEuYP11FVM5TK1Z073hVi 9tbrdtl3ldm8EilxMmzNcY22WQDkO0ol9ryW79vd8ZSTOLPmRymoiiMlrpb/2fmrr2uf F7+Q== X-Gm-Message-State: APjAAAWaBh651lK5OzSzVcofH4BQq5OIWUSltsMHDYnWIJrQ0bOH20a+ 2UtdzT1niJY/bq+vByPVbck= X-Google-Smtp-Source: APXvYqzjyC+GNwfCmaZfhSj4iqvCo2p4viZCQLG3Ong4nVA7XqNjoxK4xM82dtqi8fmCY62pgEYrzw== X-Received: by 2002:a63:1043:: with SMTP id 3mr84674107pgq.283.1555537524397; Wed, 17 Apr 2019 14:45:24 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id d68sm219314pfg.16.2019.04.17.14.45.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 14:45:23 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Himanshu Madhani , Giridhar Malavali Subject: [PATCH 25/34] qla2xxx: Use an on-stack completion in qla24xx_control_vp() Date: Wed, 17 Apr 2019 14:44:34 -0700 Message-Id: <20190417214443.243152-26-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190417214443.243152-1-bvanassche@acm.org> References: <20190417214443.243152-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch reduces the size of struct srb. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche --- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_iocb.c | 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 c9f0169b21ea..6dd2d41713c9 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -545,7 +545,7 @@ typedef struct srb { u32 gen2; /* scratch */ int rc; int retry_count; - struct completion comp; + struct completion *comp; wait_queue_head_t *cwaitq; union { struct srb_iocb iocb_cmd; diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 7ab157c079ca..60f6685cb342 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2570,7 +2570,6 @@ void qla2x00_init_timer(srb_t *sp, unsigned long tmo) timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0); sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ; 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 099d8e9851cb..b2977e49356b 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -905,7 +905,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 */ } @@ -922,6 +923,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, @@ -936,6 +938,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); @@ -953,7 +956,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: