From patchwork Thu Jun 1 23:27:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9761343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65E57602BC for ; Thu, 1 Jun 2017 23:27:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 582F628524 for ; Thu, 1 Jun 2017 23:27:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D15828544; Thu, 1 Jun 2017 23:27: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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 8798F28524 for ; Thu, 1 Jun 2017 23:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751180AbdFAX1Z (ORCPT ); Thu, 1 Jun 2017 19:27:25 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:29834 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbdFAX1W (ORCPT ); Thu, 1 Jun 2017 19:27:22 -0400 X-IronPort-AV: E=Sophos;i="5.39,281,1493654400"; d="scan'208";a="22098572" Received: from mail-co1nam03lp0021.outbound.protection.outlook.com (HELO NAM03-CO1-obe.outbound.protection.outlook.com) ([216.32.181.21]) by ob1.hgst.iphmx.com with ESMTP; 02 Jun 2017 07:27:20 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KwALux5tdUycNMRcw7YDxGVoJxpIf+5YwYmMeQjJSEQ=; b=rMX8KUfbKgRS3WTk2Glc7kXOuJLo82cjWClddxik7SnCx/crR7Xjm29+U14Xdu2NkKEbihT/5TI377rhclzEkqd7rmevHEO8GeLQ4VozX4FO6gWn8mFq/d4HhH1sRHfEBoGz5JbzBSz78AaDKldXX9WHsObOZKIX5QZyS718ZUw= Received: from DM5PR04CA0028.namprd04.prod.outlook.com (2603:10b6:3:12b::14) by DM2PR0401MB0927.namprd04.prod.outlook.com (2a01:111:e400:3c0c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Thu, 1 Jun 2017 23:27:19 +0000 Received: from BN3NAM04FT054.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::206) by DM5PR04CA0028.outlook.office365.com (2603:10b6:3:12b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10 via Frontend Transport; Thu, 1 Jun 2017 23:27:19 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; HansenPartnership.com; dkim=none (message not signed) header.d=none; HansenPartnership.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BN3NAM04FT054.mail.protection.outlook.com (10.152.93.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1101.12 via Frontend Transport; Thu, 1 Jun 2017 23:27:18 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 36.A8.51736.4D2A0395; Thu, 1 Jun 2017 16:27:17 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Thu, 1 Jun 2017 16:27:15 -0700 X-AuditID: 0ac94369-6dc8f9800000ca18-a2-5930a2d4e854 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 40.93.11415.3D2A0395; Thu, 1 Jun 2017 16:27:15 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , James Bottomley CC: , Christoph Hellwig , "Bart Van Assche" , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH v2 08/12] Introduce scsi_mq_sgl_size() Date: Thu, 1 Jun 2017 16:27:07 -0700 Message-ID: <20170601232711.29062-9-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170601232711.29062-1-bart.vanassche@sandisk.com> References: <20170601232711.29062-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGLMWRmVeSWpSXmKPExsXCddJ5ke7VRQaRBldvs1gseLOXzWLl6qNM Fhv7OSwed81gtei+voPNYvnxf0wObB7TJp1i89h9s4HN4+PTWywe67dcZfHYfLra4/MmuQC2 KC6blNSczLLUIn27BK6M/n0LmAue8Vf0NexnaWCcwtvFyMkhIWAi8f31Z/YuRi4OIYGlTBIt lxZBOdsZJc68n8PUxcgBVnX+uCZEfCOjxJzPvWwg3WwCRhLf3s9kAbFFBAolLm3rYAQpYhbY wyjRsq+FEaRZWMBMYtW9bJAaFgEViW8T77GBhHkF7CW27EiBOEJe4uyWncwgNqeAg8S+ljNM ILYQUEn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KAQAA MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39450400003)(39410400002)(39860400002)(39400400002)(39840400002)(39850400002)(2980300002)(438002)(189002)(199003)(9170700003)(2950100002)(53936002)(8676002)(2906002)(77096006)(33646002)(356003)(38730400002)(54906002)(81166006)(4326008)(189998001)(106466001)(1076002)(50226002)(50986999)(86362001)(50466002)(48376002)(478600001)(36756003)(8936002)(5003940100001)(6666003)(76176999)(72206003)(5660300001)(305945005)(47776003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0401MB0927; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT054; 1:ml765UgwxWqBSDUYE+clZxLO2Wj5S0JAP4IvnSvFTsHcHyxdgJ6RXt3lD3gOUzr/7uh7bhs2tFa0ydbXekQN2XcjFlP/WD90QbdsJzvljZy1D3b7+FeGRZ8hznit8CPho/RGdWUc09+Y9LSadAU9V9ux/yEdUeJnL/dibDDObCw3k0cg93tjy1EspTWRi45scjFU+uvql9OPMksxyqbqVJa/9NykBe5GRAmuLcPt6x0+VWjWkpvtONl5aZx+UhPHc+nPnke5fQoefpLPbcHvMXqi0L9gNMWF3VVvpbWX6URgfagb6gBiN8g0A9WO8AzWbYuId7vI9yBBx+yM1z5LusBCHqC5OmED4/7fTFGy8105crWDocC9ahjdvk+09NxSdZz9Fy1rC7R3nFi+gsR3tqVXR9Ri/PUVxFf9e6gL+aQUfmXDzQTKxSMh77ndXLscr1J04Yb7GPEzLBW49LA+pgPbpL6C/muCjqcaKJ5up6sLVL1jwoDjPqiWXnx2DnQUGR3FTde3j2aHgoLUvNmS6Z503vwXOTSf67L60x3QpHWNt5FHcdIGu4d2O7DtaRTD X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM2PR0401MB0927: X-MS-Office365-Filtering-Correlation-Id: a6a8ffd0-f987-4f53-2fb0-08d4a945bf24 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:DM2PR0401MB0927; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0927; 3:B/bHpJdMvnWyxDk9ahL9voScjJRMm3oDuW74eBP4Qe02vDO1af8jKC6+Y1trXFLlp0+P1hJZsXQT9Q7AcMJ+8KBN2sdzz0k/STs8/zziuZYbOjDfJPLJi5out7HJrkCNpVclHL7aUcV9AB+Fpnqe/nuQt4gKl84Ua7/H9JhF4AmFktTBaFtqlBRJ0WZlVKhvdCsVBXmyDxa5rSn1XZNooWp6mfsSpVigUOZvnFODKZGRXgfO+rxqgTG682ieeaqBJuUAweV1O3ThuzpRx6T+e7OOlpOrrQQGs/EK6cqRw8WFZ0FckLKNzBZVoltH+heZVTk1mhYUBjMhYZCAKlTLT73BMcSL5ZcYmkxHLOFkiJyyhOF3iRhQ7Ri0r+2v4n881Twdu18bXCAn3SS9ik9tAvbkvIgpzEc9tn3dESuFzOjCfnXIxVQ2SXuW5sbvnpwO4F2rtiVs33oBk5z5h4oSkUbR9943RedNO2d92bMidWMwQQsMphqgkav2VStKV4FtD4UwLUgs9IAbV0ZVOcOmmg== X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0927; 25:LrxnpvCHwzIZ06etHfpXRZ9ROsHP30oVr/t5GOYmkIPqlOsjpNPIoeRLqX7Z4DXElCRtPEZV4wFY1Xdlx6Qk3Jpxzyv6aK108LybW4Bh8hIN+yg6UURk/jNRB71MZwoQP2CCElwdRjrf4RApElnsvHQWaCDKrMJ+7OcqbOPE5VU2LzvtfJM30T8sHICepCTsICHSQWDOl3lg9f3hNRA6SeBUgcw2xrIBpCfTcc9AgBLvcHonuiMwohhPpOaD0mnnxSwjG5MdDvj11XNnbNjHd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antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(13018025)(5005006)(13016025)(93006095)(93004095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR0401MB0927; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR0401MB0927; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0401MB0927; 4:JF5c5IvWbr9lRKDPOBCm7SAsqIwgoRzy+LAd87JC?= =?us-ascii?Q?il76Z4J/9xrnfN6CklhFlBuzn44+t78kR0nyRTe0bT02R/3OXwaXLwbuoIwe?= =?us-ascii?Q?zTqo4u1ppMMVDktxyCSXbkanxRrFSoUySFfXq817uBepaOJ9LJ0qZ7SGqBdy?= =?us-ascii?Q?Nn8gYcwGq2oUcaX92RdaJ+UiNEGyDzN9R6xt6jDa7qRhCdaZCxuNmoT38xXd?= =?us-ascii?Q?qmR5wShJMDjwrkOlRdRk9CpOGKwxoKzyd5keMo/rEzCuLtuLETHngcAgkohh?= =?us-ascii?Q?sqof5gXkCECpPNzc2mPd5EXKqhWt/z4zQvLucBoAF2YBKJkW3hi0AnJNOVOm?= =?us-ascii?Q?PSm3Q+u0LvpWbLTfVYTxPHHScYFW81jQ8RXdIvQ+IesU5y4eBfJzL1VU4Jfl?= =?us-ascii?Q?gp5P7sstCy3ce2VYeczGDh/d7NbVX/p2QKEIKSIvbCeubYHG+p5qkC98CFj/?= =?us-ascii?Q?F7oTI127PMMDpo2uiKIsgIB/+lvjjNItnaMuQzS9tt4u4wC+YHfE0aQ3PZ4P?= =?us-ascii?Q?UyGVCHECVRJoni5aV1FjfYFE4NWLwpCIwSiWku3j0e4UOsdvfN9C4oQmxLkb?= =?us-ascii?Q?Sp6D8b19Lr4VpLsTQbTDZCYza+saeLQRrEXcs6e8WqkYe8THwP5dRtugt6FW?= =?us-ascii?Q?nNFTjt7c2j3V4u5fVtYYrvvsTJvVw9qaASQSTV6KtF2RWqMcU7reBnPNDhrx?= =?us-ascii?Q?qbjU8YlcvwmpCTeCMNidlvV4c3JYaN0IOHewV+CSIainSSyGnIq3sqwzKi00?= =?us-ascii?Q?FSe6c8vgouNfwXONX5d1jq0L9bK2bL3P+7OXwSsxlK7G6KBSHX1KTPEw9/Q/?= =?us-ascii?Q?AUVUsKB0VFjusAy42EF4AVxRJpeq088UocGfWdu6MG5tiGIBQHXZLf7xrIGu?= =?us-ascii?Q?BJLSuvONHSkwLVQab6CHK2wYe7R2S9B2c+rYxg3IS64AKmtEI8cPEPEFX9Ts?= =?us-ascii?Q?SVPQWwWkpXfchMK57zD/QaYPKajEr01fJIfmJPlzRj7zbVqf/9gpvGVKtXF9?= =?us-ascii?Q?Ame1YEkP9CPmtl7juE45HivkwHIIgvDM/BW3Hmzgj0QD4oEKrit36fbi1b73?= =?us-ascii?Q?wUoeTZ7cVKab+94BUgtog01Lsw8bSwoRxkUGbQpLCqTbt1DwJ8xiG0PKkbkC?= =?us-ascii?Q?VYQ5k20a2FxRd9s09a6UMIeXG4SQrzdvJHsEqm8AM8Wa5CrrHGIYmUuZmR+Y?= =?us-ascii?Q?jJVvkhojKLUcExQYSki4Y3rPIveE0Q+fKnoDmw5VARH4QvUt/qFMPjSXOMNf?= =?us-ascii?Q?VidGMapqiWXMNc81wSE=3D?= X-Forefront-PRVS: 0325F6C77B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0401MB0927; 23:UVTVtbaR64xWWXboVHnvBflLckCkypV4PEQQWJZ?= =?us-ascii?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rn/fFQTwTDopfmfqjqc+4wwt/g3nnTf2F+Jkx5E7bvLnGCTBaF8nyoPhvhwnvbSYo9eTzJk1Fon2Am1pn9MIlPUdE7H5b9JJUq8a7d6Wap5aggF4Zl4WOUGv6VOg/2iuHMrvKfgN+5SEIDxXFkWGYC6tHVG7xcJJVgoBudQAoep9ibdyqoJdZt8W1ha2vK3rfPvUFOx+usFns3hXC9HCFF3Hn0dzeYgGVDTMoba/Y7uCEIwsR24XJTd99Vreg9DeoU; 24:XpjAzvcR1uGhsqXo5iizEyo3gG8wTUgOmarUGvzDkSaVBj7gfmOMhb37uPrAr0kpsMOL6GHw+UhkbmL1MuZfIy2Aiv0R5KHF5XkEdE2GpOI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0401MB0927; 7:eMxU5fZW8HljCw/oZpqqDUW7CF4Vn8Wgt+Mpq/Sy8v198z1dtDwOo/1vPDm4gC8Ew0OTReO1l9eCfS60NGQdTCHalHcI7FtB4s1hCbzzf+y0fXhPcJlWc+U7PACP7peRzxw731AHSvXP/v4b05zFKC9kgx2WWyKzLuoUwe3Is7r0cvJfSXTy01PmcxQoPQd1RRSPav3f9YRVmx2SMOfib/3b8Yg9JEEY76bK8itgrMdwLG+VIH7pt+HjR8jQ8NgVL4C/gNFyz5Dldlrstil7VO75xDaXZH4sCYSBthz/dnQVv8lhZjPjtYBlX6FMmg0ADFJw9Z3oXFpULY5NsoxdmQ==; 20:klKcryfKQmvJaMG3rxdMbCp3D1NDFn22Mt2A/ItRK53p/jHXAb/HQ2byuhp4JLBOevbTLI1R8MA1+OpycZpJ2tpdNmSvfzOdwguWs9ekHINjHuMI7HjymYob1/uYvvOzuf3I9ui5jE0S0eUf6kz37+/gBImiA/druYX4EA2k2UE= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2017 23:27:18.5114 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0401MB0927 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 does not change any functionality but makes the next patch easier to read. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Johannes Thumshirn Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2c43b500e9f4..6b4fb48033fb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1858,6 +1858,13 @@ static inline int prep_to_mq(int ret) } } +/* Size in bytes of the sg-list stored in the scsi-mq command-private data. */ +static unsigned int scsi_mq_sgl_size(struct Scsi_Host *shost) +{ + return min_t(unsigned int, shost->sg_tablesize, SG_CHUNK_SIZE) * + sizeof(struct scatterlist); +} + static int scsi_mq_prep_fn(struct request *req) { struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req); @@ -1892,10 +1899,7 @@ static int scsi_mq_prep_fn(struct request *req) cmd->sdb.table.sgl = sg; if (scsi_host_get_prot(shost)) { - cmd->prot_sdb = (void *)sg + - min_t(unsigned int, - shost->sg_tablesize, SG_CHUNK_SIZE) * - sizeof(struct scatterlist); + cmd->prot_sdb = (void *)sg + scsi_mq_sgl_size(shost); memset(cmd->prot_sdb, 0, sizeof(struct scsi_data_buffer)); cmd->prot_sdb->table.sgl = @@ -2201,12 +2205,9 @@ struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev) int scsi_mq_setup_tags(struct Scsi_Host *shost) { - unsigned int cmd_size, sgl_size, tbl_size; + unsigned int cmd_size, sgl_size; - tbl_size = shost->sg_tablesize; - if (tbl_size > SG_CHUNK_SIZE) - tbl_size = SG_CHUNK_SIZE; - sgl_size = tbl_size * sizeof(struct scatterlist); + sgl_size = scsi_mq_sgl_size(shost); cmd_size = sizeof(struct scsi_cmnd) + shost->hostt->cmd_size + sgl_size; if (scsi_host_get_prot(shost)) cmd_size += sizeof(struct scsi_data_buffer) + sgl_size;