From patchwork Wed Oct 26 22:55:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9398639 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 2D38160234 for ; Wed, 26 Oct 2016 23:13:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF557209CF for ; Wed, 26 Oct 2016 23:13:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D24E929E1D; Wed, 26 Oct 2016 23:13:09 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 B1181209CF for ; Wed, 26 Oct 2016 23:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754610AbcJZXNH (ORCPT ); Wed, 26 Oct 2016 19:13:07 -0400 Received: from mail-by2nam01on0058.outbound.protection.outlook.com ([104.47.34.58]:7424 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754482AbcJZXNF (ORCPT ); Wed, 26 Oct 2016 19:13:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZlQbTSDeWCbRbgezIn/FJffLeWaNNJ1T/tKLZk6NfIM=; b=i7+NVU7KG57ylfpFZCZhf9oj3f08tivdVH/edX/YEECF+h7yUXDQtnA/XBgGZcuEU2wj66LmSjAka7qzOw4aK49mT9MewixehcLL3yUkkmlm5L9Q+H93kg/PgbC7SiEB7o06LM6+kzJj2C4GyR1Inqvvt043P3MQ4zhiBwVLBV4= Received: from CY4PR02CA0046.namprd02.prod.outlook.com (10.175.57.160) by BY1PR02MB1162.namprd02.prod.outlook.com (10.162.108.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Wed, 26 Oct 2016 22:55:04 +0000 Received: from BL2FFO11OLC003.protection.gbl (2a01:111:f400:7c09::152) by CY4PR02CA0046.outlook.office365.com (2603:10b6:903:117::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Wed, 26 Oct 2016 22:55:04 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; lists.infradead.org; dkim=none (message not signed) header.d=none; lists.infradead.org; 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 BL2FFO11OLC003.mail.protection.outlook.com (10.173.161.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.5 via Frontend Transport; Wed, 26 Oct 2016 22:55:02 +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 19.BC.61581.5F131185; Wed, 26 Oct 2016 15:45:10 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.9.6) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Wed, 26 Oct 2016 15:55:00 -0700 X-AuditID: 0ac94371-607ff7000000f08d-1b-581131f5f3db Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id ED.C8.03615.44431185; Wed, 26 Oct 2016 15:55:00 -0700 (PDT) Subject: [PATCH 09/12] SRP transport: Move queuecommand() wait code to SCSI core To: Jens Axboe References: CC: Christoph Hellwig , James Bottomley , "Martin K. Petersen" , Mike Snitzer , Doug Ledford , Keith Busch , Ming Lei , Laurence Oberman , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-nvme@lists.infradead.org" From: Bart Van Assche Message-ID: Date: Wed, 26 Oct 2016 15:55:00 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPIsWRmVeSWpSXmKPExsXCddJ5ke43Q8EIg7s/WCz+7znGZvHy/AdW i5WrjzJZrJqYZ3Hv6Bcmi723tC3mL3vKbvHsUC+LRff1HWwW5z+8YrJYfvwfk0Xbxq+MFu9/ XGd34PWY2PyO3WPnrLvsHov3vGTyeHBoM4vH5iX1HrtvNrB5fHx6i8Xj/b6rbB6fN8kFcEZx 2aSk5mSWpRbp2yVwZRz+2sxYsF2j4u/qXpYGxulKXYycHBICJhLXP09i6WLk4hASWMokMev0 U2aQhJDANkaJ5TcjYIqOdD2GKWKUmLHqJitIQlggSOJY5xUmEFtEQFbi++7XbBDNdhI/z6xn B2lgFtjDIvHvwVIWkASbgJHEt/czgWwODl6gom2PxEDCLAKqEg8O7QSbKSoQIbHp6xywcl4B QYmTM5+A2ZwC9hJrvk5nBWllFtCUWL9LHyTMLCAvsf3tHGaQVRICE9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vKMfu1Y8bEBYeeOPV1cb060va9cvXS3X8WJHsosRRnJBpqMRcVJwIA jHhf+zkCAAA= X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(87936001)(229853001)(19580395003)(7416002)(4326007)(19580405001)(47776003)(6916009)(8936002)(2906002)(65956001)(65806001)(106466001)(54356999)(7846002)(2950100002)(97736004)(4001350100001)(110136003)(53416004)(65826007)(356003)(305945005)(5660300001)(626004)(33646002)(76176999)(68736007)(50466002)(64126003)(77096005)(2270400002)(189998001)(11100500001)(92566002)(31686004)(69596002)(23676002)(8676002)(586003)(50986999)(36756003)(83506001)(81156014)(81166006)(86362001)(31696002)(230700001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR02MB1162; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC003; 1:x13bmKR0McLCO9sLCQu6I9tzXm3U4eNDYdsaUjyzIRMVxAbu/H+2LcRL0u9JTxcbHQx3OGvN1sgTZRu3PY013Njg4FjA6vqKy+ydKXCF9Syafd47QqZrkXVNyEGXgY0LSgOhTLKU6gmE+9KbMlBup79Vxt6PxY0mLPRkMTedwVHHxLBG2cb8t0ItIZXP4OVF88Gavw5Qj3xWaC4yAEK9TPUnQ8/41VMsGMOGgERXETv/z4yRqsUinq92JkTTCMvdjFIUfDlKkPUgKBUkFgAOfxbCIft9bZxuZvZmHidC1wEADzNjT5m49GRrecQAdeGHhfXtVW3ctamr9cWTuYrkqY3W97GU/ulPhuYuwF4krTrUWMmPIPHE4Bl4P5W9F1UsyLA3faiuZxweGkmgXLd4VUE2+yPWtezjdgIf+7FSTT5+APL0Hmu67YfTin6rePPVioNpidOYDajCrfRymdSv6gF3kFYjgak9jy+NZAyxAjCNsPO95Lx2mfcMKg+Vy3UNrehOaTZ56U8nrIjSFKlGVsBsvEiOXKt93EA5dFpKaaEENNkFaD64oHG4s2coZVLz X-MS-Office365-Filtering-Correlation-Id: 0435ef83-ab79-49be-17e0-08d3fdf31fca X-Microsoft-Exchange-Diagnostics: 1; BY1PR02MB1162; 2:W6UcIz+mQjr9OOE54m8S+JwWLrycWdtCzTDkt4BseU+q+SAdO9pEdwsRf0yrsQau68jDI/G8Ku+HDyv20tmk//GIBeo1K8d9291NyItiVkTAaU29OG0nxzs8FQkp0AoOJajytD0VA9/FuGKfmnerI5vkiRGtHANMVrnIEeHvCyV0Ava7rJg7zEd08/xlJsOGDc9Ca46lFpVgdNONKpfJqw==; 3:M+2o4U0Ngjf9+LK3LKba0eI1Jnma7eDQe68YyMxijw9Jk2sQaX2Kb6YCjsJGIVqHl2ahL5Qv2LXz3NADDdhu9HMjQ8GRTzSKkxAa7hHYXYZlK3jd+GbcAqY7mWF2Gw/Ure5a5G84ByVnPIUHldBlhuwGOky0ulDaNVRECx8wgvO8u3pym9+R9cjLRAV4pQAZ/a2Y9Vj9TugYjl9+0sJc1hWWhW6gBgXY9uFuDqlwy77Fk2kTKlWPQ7GwTGRm/nnTx4Uf5XISlxoFtu1P7C23h6kzUcL9krr6eUqbOhepOCQ= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BY1PR02MB1162; X-Microsoft-Exchange-Diagnostics: 1; BY1PR02MB1162; 25:7K3LFBSPqUAdO/TNE9nlJgFXfQNENK+QlJQHoBI3hyRKBLTysue4yBF7Vm39Do58f23EphP4x0y9U8SWuiTxfyO2HwA2qmzvMYrvjUffsqgGP+M2x2bti8jYdgS3c82hrgc0DhO+ULOJsgY5ldr5hoNr3T7HFtzFgV6J2HFVt5rBfU9h/tOe6m8B8+yV8k/r37FVwvDwwx64yZVshgqRRw5RC726+2eKIQzqa+awAsgarHTEjw8uzPJD/iFPtI+EBCANpEwhz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c20iEOWZsazzKzrzPHkOa+gMLS69IO9CmiYbTkPI+/YjhzMOaF2huosokVCD7tyfOW+paaVClGKXQKukWU+wFUFQszPBNJA9OIpfXJ2e+5Pj8eLZ2VKc6BGIBvoEQu/o9rET3Q2jngb7B1PIrEf52p64YLt5eThlctrFrnPCXjEI3rTcWo6yMpRmE79Gg5mKeUSMku30MGzNu0WV7drygHXsqKNaOZzsplX9oDG/B1wi2nlbXOH5/qmPTgX0exN7PYkwbAufFc1YwzvV0owQQQmJ4RKletot/eAeg/g+bbK1oyYuarKDHIqO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(104084551191319)(146099531331640)(42932892334569)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(13016025)(5005006)(13018025)(10201501046)(3002001)(6055026); SRVR:BY1PR02MB1162; BCL:0; PCL:0; RULEID:; SRVR:BY1PR02MB1162; X-Microsoft-Exchange-Diagnostics: 1; BY1PR02MB1162; 4:C8xpI0nQ2ybf9YlFQ4ioP8VzpW5t/pkPRMehnknQh8HPIYBBxVoKRTBJxAXwgdojw46E/zw2axDIFY3c9I0ch6zBaim1b510PdorMgM9dZi1CgSrjrtPYkPc9e9JgLMAHfrI6uNN7lDGYqbz4orKFxYiSLmt2yDi5HAm7GWC1NbEi//TtjBOB4catiG64p0ySPUKhFqv1Nq3nSqt6b76DkAnfkBHhpXEWtEHk0RcBkadLkRGZKxFtdmdAlA03sjKb69Ranb1Amp73QSCGQ+TD28Oj+66R+QQK1tXs/Bzs0Rsss6jimUoCyJr5wLcNnFwOTs7whsMiJS8lgMfl8xRr3bQvX9jgNsNt5cYRMiVU30em++2/wBe5spmDo2/n/RUyVdn8NXRrZki3L1VileIIttbH5A243WQznYXQY5RhFetfvZnOWQByPknDaPkX+Sndenq/AojpRfY6bHhd4fhzqZPmffXCuPYgpCi/gEXozdVvqu/VKeQjDcWc/V00Mch/LUKP00j6aYKAP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Cti?= =?utf-8?B?ZGh4c1dXZUx4MDZob3I0dkhhR1JyK1NsdnZYNGkvSzlOcWFycTRVeWEwQTk1?= =?utf-8?B?UVI3MUZhRGtqdDMxZGR0UT09?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR02MB1162; 6:WVQ/LnbVrk8aJoiXalpPNSn+n69v8mpMj0MqoVmrmAavGiIsjCyfYOyh0pNct3gmICz8UfX/LEjk9joe5n97HTq6mhu4WvucU5o4pK7pSri2qaannYlf8eP9A9x04OQ5A/02HZqNYXo0BeM8z2rM0eQFFdWE6KBBvMbIHoRDXjNmQGIoxxFwIX9pbnWdOSSJWBodige1OFtymtPeBfQZYm6lzk5fNlkjAWbTaGppO1fJGL8Qn1v0/I4Iw0dqJkqMjmR71JXIaGO7LFmbMDVuvePoVcihmH0lsVsy5B4vxtYpn6cbybnVL8fTu3qAev3ZDoa/R8VE1KIwjnmQetGsL78X/KMd1NYxahJwVH55FSk=; 5:uZ97cmglPCZ2rZzycd9PRKQvEV0Ne+LybKQqLKxNRGD0xgXdgSIVD+ItakQMyEJkAEElirM12O4ayH3usA5mp0q2mnJF3Pd+9MYeprerTUDHJwATJqVCWvtDzycBgX/Rt/2qSjmr+rGAuQsoBA45XQ==; 24:l+WPc/IEbsDrHU5n8zPi519fGGqNiUB+vLaqTZ4B4tPS5WvmCbYJBTDpQlm5lLL6/BrcKqDlgkBF8Xq4qHdaOJU54KqZusfcQUEUisITRFo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR02MB1162; 7:ksRkAPfYO1flRgh7tnqPHa3Fsrs6yqhP1iplz4E6eChzJDqaB382r5YxYwoV0s+zIUVo9sPlaoCNi99DP0VwdF2N/8oGLIw8U1zpDEiLVKvFeRekJmnePPc9r+8EQOTBl5kuyeMY9ZWjEo6YkTtkyXvkCa0gQnjKTmeRJNMEcwOLI4/21G/q0rVLBSFJpefFAGS8sDEG4Zab6HtuAhBVtYg+Wkjli60jMbiRwJvbWCEHe6sCKADWwxcoGJbzNjTD/NoegJucIUY0SpP8NjWnwfdAEW4WHxzLeEksQDNUBolk5kHPUZwrTCsmrbukHH/PTpLHfeoxUBMdOtJJhfPbsI7uz6C0+IqCcvt65hUzBU8=; 20:lAdOj2tUtyQIN9WQ4Zne8C4dGK7ETcFXd31uMpY0oCnMecDKJcWDixZhe52lgRGe3QdVKbwJHpf7ffOLgqAcH1KZL+EMv/EJd6s499Gen696xxG+PY92oC2CECVDQ2EAdLPGRXr1W951peeH2MBPH2ravERRWC+JBMvkAN8sscG/3PI2tQOvmkIDmk37reuXH41IxDz6kxsCJpafqz4E05MAvEXnyZFFNlkDmDpVqKxG+BFsWPZ5oU2Ok+9Ola/9 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2016 22:55:02.1154 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR02MB1162 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Additionally, rename srp_wait_for_queuecommand() into scsi_wait_for_queuecommand() and add a comment about the queuecommand() call from scsi_send_eh_cmnd(). Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: James Bottomley Cc: Martin K. Petersen Cc: Sagi Grimberg Cc: Doug Ledford Reviewed-by: Johannes Thumshirn Reviewed-by: Sagi Grimberg --- drivers/scsi/scsi_lib.c | 41 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_transport_srp.c | 35 ++------------------------------- include/scsi/scsi_host.h | 1 + 3 files changed, 44 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ab5b06f..c1561e7 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2722,6 +2722,47 @@ void sdev_evt_send_simple(struct scsi_device *sdev, EXPORT_SYMBOL_GPL(sdev_evt_send_simple); /** + * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() + * @shost: SCSI host for which to count the number of scsi_request_fn() callers. + * + * To do: add support for scsi-mq in this function. + */ +static int scsi_request_fn_active(struct Scsi_Host *shost) +{ + struct scsi_device *sdev; + struct request_queue *q; + int request_fn_active = 0; + + shost_for_each_device(sdev, shost) { + q = sdev->request_queue; + + spin_lock_irq(q->queue_lock); + request_fn_active += q->request_fn_active; + spin_unlock_irq(q->queue_lock); + } + + return request_fn_active; +} + +/** + * scsi_wait_for_queuecommand() - wait for ongoing queuecommand() calls + * @shost: SCSI host pointer. + * + * Wait until the ongoing shost->hostt->queuecommand() calls that are + * invoked from scsi_request_fn() have finished. + * + * To do: avoid that scsi_send_eh_cmnd() calls queuecommand() after + * scsi_internal_device_block() has blocked a SCSI device and remove and also + * remove the rport mutex lock and unlock calls from srp_queuecommand(). + */ +void scsi_wait_for_queuecommand(struct Scsi_Host *shost) +{ + while (scsi_request_fn_active(shost)) + msleep(20); +} +EXPORT_SYMBOL(scsi_wait_for_queuecommand); + +/** * scsi_device_quiesce - Block user issued commands. * @sdev: scsi device to quiesce. * diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index e3cd3ec..8b190dc 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -402,36 +401,6 @@ static void srp_reconnect_work(struct work_struct *work) } } -/** - * scsi_request_fn_active() - number of kernel threads inside scsi_request_fn() - * @shost: SCSI host for which to count the number of scsi_request_fn() callers. - * - * To do: add support for scsi-mq in this function. - */ -static int scsi_request_fn_active(struct Scsi_Host *shost) -{ - struct scsi_device *sdev; - struct request_queue *q; - int request_fn_active = 0; - - shost_for_each_device(sdev, shost) { - q = sdev->request_queue; - - spin_lock_irq(q->queue_lock); - request_fn_active += q->request_fn_active; - spin_unlock_irq(q->queue_lock); - } - - return request_fn_active; -} - -/* Wait until ongoing shost->hostt->queuecommand() calls have finished. */ -static void srp_wait_for_queuecommand(struct Scsi_Host *shost) -{ - while (scsi_request_fn_active(shost)) - msleep(20); -} - static void __rport_fail_io_fast(struct srp_rport *rport) { struct Scsi_Host *shost = rport_to_shost(rport); @@ -446,7 +415,7 @@ static void __rport_fail_io_fast(struct srp_rport *rport) /* Involve the LLD if possible to terminate all I/O on the rport. */ i = to_srp_internal(shost->transportt); if (i->f->terminate_rport_io) { - srp_wait_for_queuecommand(shost); + scsi_wait_for_queuecommand(shost); i->f->terminate_rport_io(rport); } } @@ -576,7 +545,7 @@ int srp_reconnect_rport(struct srp_rport *rport) if (res) goto out; scsi_target_block(&shost->shost_gendev); - srp_wait_for_queuecommand(shost); + scsi_wait_for_queuecommand(shost); res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; pr_debug("%s (state %d): transport.reconnect() returned %d\n", dev_name(&shost->shost_gendev), rport->state, res); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 7e4cd53..0e2c361 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -789,6 +789,7 @@ extern void scsi_remove_host(struct Scsi_Host *); extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); extern void scsi_host_put(struct Scsi_Host *t); extern struct Scsi_Host *scsi_host_lookup(unsigned short); +extern void scsi_wait_for_queuecommand(struct Scsi_Host *shost); extern const char *scsi_host_state_name(enum scsi_host_state); extern void scsi_cmd_get_serial(struct Scsi_Host *, struct scsi_cmnd *);