From patchwork Wed Jul 8 09:06:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 6742921 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3AA5F9F2F0 for ; Wed, 8 Jul 2015 09:06:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56FD7206A5 for ; Wed, 8 Jul 2015 09:06:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E80D206BA for ; Wed, 8 Jul 2015 09:06:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934547AbbGHJGn (ORCPT ); Wed, 8 Jul 2015 05:06:43 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35939 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934509AbbGHJGc (ORCPT ); Wed, 8 Jul 2015 05:06:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E61B5AD58; Wed, 8 Jul 2015 09:06:24 +0000 (UTC) From: Hannes Reinecke To: James Bottomley Cc: Christoph Hellwig , linux-scsi@vger.kernel.org, "Martin K. Petersen" , Bart van Assche , Hannes Reinecke Subject: [PATCH 10/20] scsi_dh_alua: put sense buffer on stack Date: Wed, 8 Jul 2015 11:06:08 +0200 Message-Id: <1436346378-96518-11-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1436346378-96518-1-git-send-email-hare@suse.de> References: <1436346378-96518-1-git-send-email-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We don't need to have the sense buffer available all the time, putting it on stack is totally sufficient. Signed-off-by: Hannes Reinecke --- drivers/scsi/device_handler/scsi_dh_alua.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 61301cf..ea4a920 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -75,8 +75,6 @@ struct alua_dh_data { unsigned char *buff; int bufflen; unsigned char transition_tmo; - unsigned char sense[SCSI_SENSE_BUFFERSIZE]; - int senselen; struct scsi_device *sdev; activate_complete callback_fn; void *callback_data; @@ -379,6 +377,7 @@ static int alua_check_sense(struct scsi_device *sdev, */ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_for_transition) { + unsigned char sense[SCSI_SENSE_BUFFERSIZE]; struct scsi_sense_hdr sense_hdr; int len, k, off, valid_states = 0; unsigned char *ucp; @@ -393,11 +392,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_ expiry = round_jiffies_up(jiffies + h->transition_tmo * HZ); retry: - retval = submit_rtpg(sdev, h->buff, h->bufflen, h->sense, h->flags); + retval = submit_rtpg(sdev, h->buff, h->bufflen, sense, h->flags); if (retval) { if (!(driver_byte(retval) & DRIVER_SENSE) || - !scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE, + !scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, &sense_hdr)) { sdev_printk(KERN_INFO, sdev, "%s: rtpg failed, result %d\n", @@ -532,6 +531,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_dh_data *h) { int retval; + unsigned char sense[SCSI_SENSE_BUFFERSIZE]; struct scsi_sense_hdr sense_hdr; if (!(h->tpgs & TPGS_MODE_EXPLICIT)) { @@ -564,11 +564,11 @@ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_dh_data *h) } /* Set state to transitioning */ h->state = TPGS_STATE_TRANSITIONING; - retval = submit_stpg(sdev, h->group_id, h->sense); + retval = submit_stpg(sdev, h->group_id, sense); if (retval) { if (!(driver_byte(retval) & DRIVER_SENSE) || - !scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE, + !scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, &sense_hdr)) { sdev_printk(KERN_INFO, sdev, "%s: stpg failed, result %d",