From patchwork Fri Apr 21 21:26:34 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: 9693757 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 34BD560328 for ; Fri, 21 Apr 2017 21:27:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 254C62846A for ; Fri, 21 Apr 2017 21:27:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A32328677; Fri, 21 Apr 2017 21:27:03 +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 163E22866E for ; Fri, 21 Apr 2017 21:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422901AbdDUV07 (ORCPT ); Fri, 21 Apr 2017 17:26:59 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:43220 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422807AbdDUV04 (ORCPT ); Fri, 21 Apr 2017 17:26:56 -0400 X-IronPort-AV: E=Sophos;i="5.37,231,1488816000"; d="scan'208";a="12881811" Received: from mail-cys01nam02lp0047.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.47]) by ob1.hgst.iphmx.com with ESMTP; 22 Apr 2017 05:26:46 +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=LOg7endBNxm0ZyYESORNoShcqjJluqeFkqI48gbYHU0=; b=PC1jr0y5ABEHCBk9HfXACjp5/JB6HjXvpztHrbWKHs/XCjAh0Pr4PafCyEirjawZ5WGNJvqqxMXaBrZD/XODK5PKbEFgz8PMopXS/BwRIiBViyezZKU2imPv4r/01PMKJGvOThLGnqxWMpBLMEunJ/ANo/SNjtrDgJwZ3w7Bxg8= Received: from CY4PR04CA0032.namprd04.prod.outlook.com (10.172.133.18) by BLUPR04MB401.namprd04.prod.outlook.com (10.141.26.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 21 Apr 2017 21:26:44 +0000 Received: from BN3NAM04FT033.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::207) by CY4PR04CA0032.outlook.office365.com (2603:10b6:903:c6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13 via Frontend Transport; Fri, 21 Apr 2017 21:26:43 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by BN3NAM04FT033.mail.protection.outlook.com (10.152.92.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1047.9 via Frontend Transport; Fri, 21 Apr 2017 21:26:42 +0000 Received: from MILHUBIP04.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 92.9E.19026.1197AF85; Fri, 21 Apr 2017 14:26:41 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Fri, 21 Apr 2017 14:26:39 -0700 X-AuditID: 0ac94371-41ba798000004a52-57-58fa7911122a Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 3D.14.18148.F097AF85; Fri, 21 Apr 2017 14:26:39 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , James Bottomley CC: , Bart Van Assche , Israel Rukshin , "Max Gurtovoy" , Hannes Reinecke , Song Liu Subject: [PATCH v4 2/4] Introduce scsi_execute_async() Date: Fri, 21 Apr 2017 14:26:34 -0700 Message-ID: <20170421212636.14376-3-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170421212636.14376-1-bart.vanassche@sandisk.com> References: <20170421212636.14376-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRmVeSWpSXmKPExsXCddJ5ka5g5a8IgxenFCz2LJrEZHFj8VoW i439HBbd13ewWSw//o/J4vSjA+wWPw+fYXZg95jY/I7dY9qkU2wez6YfZvL4+PQWi8fm09Ue nzfJBbBFcdmkpOZklqUW6dslcGVc+HKRseClekXL82eMDYy3FLoYOTgkBEwk5twN62Lk4hAS WMok8eTBQmYIZwejxLV1m5m6GDnBivpnz2OFSGxklDhz9wALSIJNwEji2/uZYLaIQKHEpW0d jCBFzAL3GSWOH7sE1i0sYCbxY/tGsCIWAVWJCZ/+MoPYvAL2EhOPbIXaIC9xdstOsDingIPE y8UTwGwhoJoZL5qgapaxSrz7EwLRKyhxcuYTsJnMA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-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39450400003)(39840400002)(39860400002)(39410400002)(39400400002)(39850400002)(2980300002)(438002)(199003)(189002)(9170700003)(47776003)(48376002)(33646002)(81166006)(50986999)(356003)(575784001)(2906002)(8676002)(86362001)(76176999)(189998001)(54906002)(4326008)(106466001)(8936002)(50226002)(1076002)(5003940100001)(305945005)(36756003)(38730400002)(53936002)(5660300001)(77096006)(2950100002)(6666003); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR04MB401; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT033; 1:rcGCuCNblqX7u8vkf3+CmRLPOkLCMVh7QZ7CJ6r1SCQcLOpRnJ2mQlfSv7iwz/0yVFaRiXpoYZoD7+JH+4p7hCZDislAhmYNOJhRY2+C2dmgsj+xN7oxPH1Vul37chkOQCSGB0aG4RIL+kA9Vc1xAO5kajvahTHXghOY2OMMyYL0w+Pyl2zhSWzfgEcCDpqyS9MdVTPD463NjzoVErEmTYcEs/93njN0oWbzMEGrDDbE5I9EDnS9vpe/o/3kyvVCIXvHrjvX1fxkWJSDxjUIraxo3YefAgkA3UfcuTVzN9LjJkX8lq8GHiaAkCGLPWxpiDSACAOWq+JJC0RDJr3hqrqcoRR2WbkfI5o31HZPZyf42fCw8nvbElcD/i6sc7ADYv1XU//MA2Ec4zqvGrCxnhdBjq75KN8k612Skxe95r7QvwzQSsSUWs/llQI3kxHJadOGCT2XRbxllTmVmhp93gnwEveYs51uAR1ZJXILticsFt+Y2i+LyxIdREwZS4OPiNi8pk8/GDuqvan4DuPumw== X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: abd72caf-48ba-47dd-c437-08d488fd1b47 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BLUPR04MB401; X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB401; 3:gNB2x1PuvTEgDPSRH8aPv5vuG1mtG/uMvIox2r4fjmAtEfzYT8DuBxwa6ySL48+iZe4tlQPPwzuvRQQCCii3G7dMyMMMrHkkRFekSIotbBHo5/6SOeHn8s3HsF8pmVWypRQC6OHxaS/4Hahx9D6ENTAzduWYa2g20c7n2GPI7S5yxzUfYLn9pH34WNctpi2MCR5UqljOekFmZbL1u4Yrixbw9alFWeKhAXuJnFZY6m31aKNmyNM9/k2X/jdoMXBIfolwiqwDdLFZkF9Hg5OoG+Emiiz0/x+3pFfwfOgzZtCNbeGA6Dvpa1ee0rLvZCOHr2js1Y/0tCZa91p87fet02QCRMRBVFejrG638VDbS6cwej/pVWMOOaldr2/jjsLBZXtZH56J/CwdtkyOWnTBD8gxjt+XvGOV58idMxgKZ7iJGCEbF90eqqbiEra+2dHxgS8kTh+Fy1iV9Vyz66FdMiImDwVrCuB7lc29ABl78axrWEYJag6WdGkZoFFN5fTPlv14G60VEq+U7LiepCRQhw== X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB401; 25:LZiehLE1//MP0z/possBNWeHgDYNZVgETdpGu6tz29IvAO0xLku5z/ZKkxCtjSLospWVdGTklV8z/t+xMHvtb2nIOMEHCrARsseeY4inx4KA8u8QqwCmfAl9PESBHVSde/rAKe9WKji8EW9m4XBJtQRUMoRvxEhULRysO2RfBCfWJumUhfFfyk5VE7RuMzl8Ienex0sADcfXvc/9uPdDPeNmhVIBJfgN2aB7vWZfFNfz9NtLgqQMLnTUacaldAZFRmSsAzZuXHQM+4kC4c8bNdZ0LFHTH2Vsp3qJkHQKhEpym9j+doC1N+2V6Dl48FRceOc64KIAUWW+7kfIXc1cZwy11wQ/SQ/2vALXvDQr5dOWV4ripkNfWPM7R7IV0CWoblBGRX1FN3WGsLpdmlbzG6/DXVu0BHF3y4QONM0CapN0BF6qxlgSCf4joAiAfzBxGInJirS0Q4uSdaokci3gMw==; 31:/qxFuN5842OZVC8URVV6LPfHj89uvmM4Hv+TNywcdn0NflSlgt/8xMlJWtgR/KdathoWX0/4jYvIMvm4/mXf8OxGCfmJ2usffzoyuo5US2/kUqsbxlo1axH+oa6FUryoe09l/PQlh5G2QoDlxc6LI+L00VyFXhZlbXQMwHC9J3j1oXxE751hireT+N2VmyoVKNEmTfrlWBE+KcDw5xiZt0K9shjcIV3/EuAr+I4dAkqh506+j24LvTYTKEyxGWyKGIX0H8jB/Wxq+cI59tpaaGKjb7x/sIjIEHn69izOfn4= WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB401; 20:HzzmiFEFLKiUhhSFPjcOFrNIZD/UL1HEWEVz9wjwJtmVt+xQaQMwxOngADPOyByeKHkofBrkJ5mOEwrlj1aOT1BFAirnnFkfasapls1qH1EGj/pWrxIl9oILzNtrvmnrvm+vCG7fY6bzdJT69jRhSUrgZ8zsbfrOsolh4m8irCozgIEh0LNdhhKTRNV5/trr9hE6QHLhzyhyCIMazveXr9rqGmpknXVdvayRAbQcfktUl4x32J2gJXVDvhM4oRGLlEDM3y3NW0EgCYpLA9UrlTe2sjN29Jp7mA2mJG+lhR5yek5TNq8TbeEnxWTlRJdWXpdwqwkdggv05rlSASNdF99QujHzD8NUU5h+LWOsVVuItUOraRA6No+DFUNYIrEE/rbk7qL0XiMpru5l2h4pKzr9xmsEMmP+/l9Uzn+0sM3Ijmpd6ySl+5kU5erJS1qBxfP2rkEeB+9uZkRSjBBTYde2Ia4cBhDYf0Olf6puX+bTFKQ3fCtnPFinTNCb2baz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13018025)(13016025)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(20161123564025)(20161123562025)(20161123560025)(6072148); SRVR:BLUPR04MB401; BCL:0; PCL:0; RULEID:; SRVR:BLUPR04MB401; X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB401; 4:A9YLBWKIIzyOiP3T1sbpklx12le6CmeSbCcz8/arv7MQzmjE8ZJ+Do42Fv8awgmeIzVk2jOPcMGNJYfDmaF2a+nHhnAx1z6sH7evkh8VVNSletTUXDvQc0W5NQQHBbGzba7Rk+VGVri7qcHoy/g9mBlIYxWkiWM1jOPSq6EICZG9OHqcH55SY+nsJm3wsLppHPi5ynQ1X78UI9KLXUF6QT+kef/uP+/F8pg1KDPvCoiitpp0xJhwwNtMtjJBCRH7P9p6hCTClXCJFAAsFawb+aRWJGj6fdg36k4E9hRLW7ispoTwoQebpn4fAtPyYqtRke0NVq3sWbyyKNbJIA0+6aMPmZXfNH2uGdRsTcvA3YsTbHJs0VFC8Qgyo1j4WcvDW+Y2A7YHmj6JSJ21wx9QH3zKSrf0rLFzRgqKkmkthSZflSQ9l6+EYEB/lmNdPAnqiF4AZErhX5H5nkJSoJyReuRDZT4Mh0FYAJQvT/urCJ2L9d43uzJLd42Zc+QloHKlzQMDvNiBYRmoedck8mqmUjdkp09WgyZevEPGQRjycD/RqR2Ma1cDGXTVtSB2dUnr2gaeDj/Fa/KTB3K6jc7R4GgUjYCCi5tO7dMjIdaH/KOpQEF4tmicC48W7TE8axi+C8nWjzLTxzSOE571x+JIONvwFfhDeWacmlaOTnMlrrlCgEkSLue1pJQay/I3rUnFNUT8ahlXWqvR0HCk666a8PBaQHiTEMxdcJUwOgscP5VA9+Fj88d/ne4favzWXtUo8Gqvt2qpnC6QM/9CrBqPWGHfMCercsWvTu6MME53D50XA/0UPRvoCJgdt86TW5IgZH9SJKvkufuDiybtU32vN47phSM7bt6tvntOr3YNRJQ= X-Forefront-PRVS: 02843AA9E0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR04MB401; 23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Microsoft-Exchange-Diagnostics: 1; BLUPR04MB401; 7:wJ5hxR5+yrcauU/CUC6depcMBePMl+ZSYRD3NRB/GXExjcLrBEz2g3ENnLdqI0899RuY4tywJlwVYoidRdPDBDwdGkwGOyuDNxEGZK6QhxSyuUjzZiNKNrWfWoDiInX8+zrUnY0nq5MAXtGIeCqckK7shDfb4V0ME1fSmMJwSEXcWEQ5sqFAzJz7gESotqpZB/S4Avw+HhvAVchMFmlFiRsWGiEV5q+kmiDsxnrPxfNhLV5zwmjgfpPGgbTFL6iFrBvAWjarSIIWNIkUkj8Dl1VCePvUg7poHsU52FAXDc2n85TvL5+UWouSY2v0yGYzDGwVFP6ODHIj2x9wUprtqw==; 20:fZo2WfNFX0Sm0vD+lLDcwfL2b7lN3BCxwVsuYLzOZi+250NWdU2jCBl7GWYb4Ct1G3pBtJDzw3bx09by+UuKvpU2GwFp+4rKj/Q6ngfkUGZf5HXQbIEQp2OR6mqF4q1IDKckvnNwzMta/DRIXWFpONDpcTb6OADuaR/FCOUYxSE= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2017 21:26:42.5311 (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.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR04MB401 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 Move the code for submitting a SCSI command from scsi_execute() into scsi_build_rq(). Introduce scsi_execute_async(). This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Israel Rukshin Cc: Max Gurtovoy Cc: Hannes Reinecke Cc: Song Liu --- drivers/scsi/scsi_lib.c | 89 +++++++++++++++++++++++++++++++++++++--------- include/scsi/scsi_device.h | 5 +++ 2 files changed, 77 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ffa6e61299a9..7f9c70fd0acd 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -213,6 +213,73 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) __scsi_queue_insert(cmd, reason, 1); } +static struct request *scsi_build_rq(const struct scsi_device *sdev, + const unsigned char *cmd, int data_direction, void *buffer, + unsigned bufflen, int timeout, int retries, u64 flags, + req_flags_t rq_flags) +{ + struct request *req; + struct scsi_request *rq; + int ret; + + req = blk_get_request(sdev->request_queue, + data_direction == DMA_TO_DEVICE ? + REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM); + if (IS_ERR(req)) + return req; + rq = scsi_req(req); + scsi_req_init(req); + + if (bufflen) { + ret = blk_rq_map_kern(sdev->request_queue, req, + buffer, bufflen, __GFP_RECLAIM); + if (ret) { + blk_put_request(req); + return ERR_PTR(ret); + } + } + + rq->cmd_len = COMMAND_SIZE(cmd[0]); + memcpy(rq->cmd, cmd, rq->cmd_len); + req->retries = retries; + req->timeout = timeout; + req->cmd_flags |= flags; + req->rq_flags |= rq_flags | RQF_QUIET | RQF_PREEMPT; + + return req; +} + +/** + * scsi_execute_async - insert a SCSI request + * @sdev: scsi device + * @disk: gendisk pointer that will be stored in the request structure + * @cmd: scsi command + * @data_direction: data direction + * @buffer: data buffer + * @bufflen: length of buffer + * @timeout: request timeout in seconds + * @retries: number of times to retry request + * @flags: flags for ->cmd_flags + * @rq_flags: flags for ->rq_flags + * @done: I/O completion function + */ +int scsi_execute_async(const struct scsi_device *sdev, struct gendisk *disk, + const unsigned char *cmd, int data_direction, void *buffer, + unsigned bufflen, int timeout, int retries, u64 flags, + req_flags_t rq_flags, rq_end_io_fn *done) +{ + struct request *req; + + req = scsi_build_rq(sdev, cmd, data_direction, buffer, bufflen, timeout, + retries, flags, rq_flags); + if (IS_ERR(req)) + return PTR_ERR(req); + /* head injection *required* here otherwise quiesce won't work */ + blk_execute_rq_nowait(req->q, disk, req, 1, done); + + return 0; +} +EXPORT_SYMBOL(scsi_execute_async); /** * scsi_execute - insert request and wait for the result @@ -242,24 +309,12 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, struct scsi_request *rq; int ret = DRIVER_ERROR << 24; - req = blk_get_request(sdev->request_queue, - data_direction == DMA_TO_DEVICE ? - REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM); + req = scsi_build_rq(sdev, cmd, data_direction, buffer, bufflen, + timeout, retries, flags, rq_flags); if (IS_ERR(req)) - return ret; - rq = scsi_req(req); - scsi_req_init(req); + return PTR_ERR(req); - if (bufflen && blk_rq_map_kern(sdev->request_queue, req, - buffer, bufflen, __GFP_RECLAIM)) - goto out; - - rq->cmd_len = COMMAND_SIZE(cmd[0]); - memcpy(rq->cmd, cmd, rq->cmd_len); - req->retries = retries; - req->timeout = timeout; - req->cmd_flags |= flags; - req->rq_flags |= rq_flags | RQF_QUIET | RQF_PREEMPT; + rq = scsi_req(req); /* * head injection *required* here otherwise quiesce won't work @@ -282,7 +337,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, if (sshdr) scsi_normalize_sense(rq->sense, rq->sense_len, sshdr); ret = req->errors; - out: + blk_put_request(req); return ret; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 080c7ce9bae8..38c73ee0a929 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -408,6 +408,11 @@ extern const char *scsi_device_state_name(enum scsi_device_state); extern int scsi_is_sdev_device(const struct device *); extern int scsi_is_target_device(const struct device *); extern void scsi_sanitize_inquiry_string(unsigned char *s, int len); +extern int scsi_execute_async(const struct scsi_device *sdev, + struct gendisk *disk, const unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + int timeout, int retries, u64 flags, req_flags_t rq_flags, + rq_end_io_fn *done); extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr,