From patchwork Wed Jan 23 19:10:13 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: 10777759 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 D0D836C2 for ; Wed, 23 Jan 2019 19:10:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2DBE2DAA1 for ; Wed, 23 Jan 2019 19:10:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6E9F2DAD8; Wed, 23 Jan 2019 19:10:59 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 282442DAA1 for ; Wed, 23 Jan 2019 19:10:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbfAWTK5 (ORCPT ); Wed, 23 Jan 2019 14:10:57 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:52577 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbfAWTK4 (ORCPT ); Wed, 23 Jan 2019 14:10:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=/Ej4F9EG7X3OaU+MusGyj72M3Z81HHa5kjp3jsQWVok=; b=WY82zA/e0RVI 0wV2EYNb+U+LJwIEIySkhK95eUFfncUMRQVz3kx+9QPpf52nrpcyY0mIWi/eNQgDZVKvnQadQlxqB 7cZyAp/XiDmVGhwNcWEXMRSQkscs3DLjW9nS6EneKxNL6SIlFDdRUTziPrvUqnqGAlhMilZxMajCv m8HFO4uFOfI4WQ1l1RysBE5oGWZz2q4S7OUK/iPz4HBMRNXNEPmqf9zs6pGs4SlOw13vm0iLj6QGi 4oPZJtCWsXsxBIjUL9TsFJSNgvoCjXW+q6cXCelP53Sd4S8t2r5IHpZJfQl8qc5nwmFAuVVjELuum aB254SsC6o509l2MuAUmgw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gmNv6-00099X-3Q; Wed, 23 Jan 2019 20:10:40 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 92374C04F4; Wed, 23 Jan 2019 20:10:35 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Oliver Neukum , Douglas Gilbert , Hannes Reinecke , Christoph Hellwig , linux-usb@vger.kernel.org Subject: [PATCH v2 7/7] Move the resid member from struct scsi_data_buffer into struct scsi_cmnd Date: Wed, 23 Jan 2019 11:10:13 -0800 Message-Id: <20190123191013.119684-8-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.321.g9e740568ce-goog In-Reply-To: <20190123191013.119684-1-bvanassche@acm.org> References: <20190123191013.119684-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.01) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5krwn43559XFYeTz+eDPpSV602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTZnx3upumnqWBHj0/Vmi/pASQQA8gPlICyOXF4VQA3r681n IyHanrMzYl1QUFnGrJlGZdzQSLJYSD89hpteF8v30ykPg8qyrdUV98WGlbOjhJdwZpOImhB57vlA Ovnv7bRi5a8LLfqBhzJbqPiIMA+NwvuNfDLiANscU/nS1UXm73USUhwJiA5feVp4LFxEdpdB3ylJ Dm+BpEBBclKFyxopKHb4vPmSIbdfueR6G1BiAPiWAoh64PO5p3svaPBDMwtjBMLLaM2KtLCkia0v MuKlxYBvuVF2Z+Bct0um2wwqxOKVse1sVhWabI0/+PN3sILfno2VGCQBTzV5700QuyS2nB91/WsJ i78ADPGYDhYdq5Txl/4H2pIk/NKx9kdZyuRMs3x71t5DHCETMYRS4C1JUuIF2yn03s7TS3ghm2vg Bpb5Pn6ftQZVK9K8EAjn37sUg69eDYNe2itClT3S7bjQUCo5PZJsLcY5FmNhp+JDxmImhzCOs+Do i9A98MTofQFPXMPn2jxw9gqzj3gEGJhZPn1u8Aa0teCaL50mskfArty8vJm3Q5aLHZ2GtrfzOwDf X8TdqEXkwxwMjsp2mNApsBWz8AU2Nk3qXE8st8jJti8/3bImoUNQxaBiRh+ELzS72ayHXNa7vYhj SP/fYtnzQX37JU+j2xceOC41WdirPFUt6Nn24V/0KlBUenwzWPTonV+E7OMXRvgtdyMlnmWiBWCH OalfrqeuAeh0nF8OVU9Tfz3bky3mmnWsMBVelwFiCKATxN+BYK4nmvlAmRWn2lv5QJ9vfU3IU72h POd4zx5xoUKlcleRNY2IgcugHFfrBp6xGXFNG/RaqueR+OkdBTlhpmV1p9BzLNTsJlzkQcoBMMMF nt8VzQUPDSXZuD4gcpX9yUWXReSxyvmkjs27/gwoEA3kOiKB/0U8Qy7Tf9/UCyUvn8EiIZr2I4hk tOAqUxd6+fjolVFMnEligJLyfmYqJZjirICi9MqwuAqImlPfZ9m3/W0Ujjhn8ztlwD0seGxvsutB 5vCqx+3Xa4gI0TK8OQ3cB9QF11y72DRSHL77YW8ojGTgH7yY8C/ODDttMOlXJu+mEAJiKefYDz+P zbBZVuMc79ykmmxiW8WEz5AuKs375es6QRgEpoHtxKbyD5f007X1blRae6svbWKKombdVSqNouI1 tb6Q9ERYlA== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch does not change any functionality but reduces the size of struct scsi_cmnd. Cc: Oliver Neukum Cc: Douglas Gilbert Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: linux-usb@vger.kernel.org Signed-off-by: Bart Van Assche --- drivers/scsi/scsi_lib.c | 2 -- drivers/usb/storage/uas.c | 8 +++++--- include/scsi/scsi_cmnd.h | 9 ++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index bcbf266e4172..4feba3b5aff1 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -945,14 +945,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) * scsi_result_to_blk_status may have reset the host_byte */ scsi_req(req)->result = cmd->result; - scsi_req(req)->resid_len = scsi_get_resid(cmd); if (unlikely(scsi_bidi_cmnd(cmd))) { /* * Bidi commands Must be complete as a whole, * both sides at once. */ - scsi_req(req->next_rq)->resid_len = scsi_in(cmd)->resid; if (scsi_end_request(req, BLK_STS_OK, blk_rq_bytes(req), blk_rq_bytes(req->next_rq))) WARN_ONCE(true, diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 36742e8e7edc..ea40fd78e6ff 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -365,7 +365,7 @@ static void uas_stat_cmplt(struct urb *urb) static void uas_data_cmplt(struct urb *urb) { - struct scsi_cmnd *cmnd = urb->context; + struct scsi_cmnd *cmnd = urb->context, *cmpl_cmd = NULL; struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata; struct scsi_data_buffer *sdb = NULL; @@ -375,10 +375,12 @@ static void uas_data_cmplt(struct urb *urb) spin_lock_irqsave(&devinfo->lock, flags); if (cmdinfo->data_in_urb == urb) { + cmpl_cmd = scsi_in_cmd(cmnd); sdb = scsi_in(cmnd); cmdinfo->state &= ~DATA_IN_URB_INFLIGHT; cmdinfo->data_in_urb = NULL; } else if (cmdinfo->data_out_urb == urb) { + cmpl_cmd = scsi_out_cmd(cmnd); sdb = scsi_out(cmnd); cmdinfo->state &= ~DATA_OUT_URB_INFLIGHT; cmdinfo->data_out_urb = NULL; @@ -401,9 +403,9 @@ static void uas_data_cmplt(struct urb *urb) if (status != -ENOENT && status != -ECONNRESET && status != -ESHUTDOWN) uas_log_cmd_state(cmnd, "data cmplt err", status); /* error: no data transfered */ - sdb->resid = sdb->length; + cmpl_cmd->req.resid_len = sdb->length; } else { - sdb->resid = sdb->length - urb->actual_length; + cmpl_cmd->req.resid_len = sdb->length - urb->actual_length; } uas_try_complete(cmnd, __func__); out: diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 8f3ed55a5ee5..9035c760cae0 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -35,7 +35,6 @@ struct scsi_driver; struct scsi_data_buffer { struct sg_table table; unsigned length; - int resid; }; /* embedded in scsi_cmnd */ @@ -229,22 +228,22 @@ static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd) static inline void scsi_in_set_resid(struct scsi_cmnd *cmd, int resid) { - scsi_in_cmd(cmd)->sdb.resid = resid; + scsi_in_cmd(cmd)->req.resid_len = resid; } static inline int scsi_in_get_resid(struct scsi_cmnd *cmd) { - return scsi_in_cmd(cmd)->sdb.resid; + return scsi_in_cmd(cmd)->req.resid_len; } static inline void scsi_out_set_resid(struct scsi_cmnd *cmd, int resid) { - cmd->sdb.resid = resid; + cmd->req.resid_len = resid; } static inline int scsi_out_get_resid(struct scsi_cmnd *cmd) { - return cmd->sdb.resid; + return cmd->req.resid_len; } static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)