From patchwork Wed May 24 00:34:09 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: 9744733 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 31976602A7 for ; Wed, 24 May 2017 00:35:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2560128867 for ; Wed, 24 May 2017 00:35:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A4DA28869; Wed, 24 May 2017 00:35:36 +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=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 8EECB2886B for ; Wed, 24 May 2017 00:35:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765699AbdEXAfe (ORCPT ); Tue, 23 May 2017 20:35:34 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:54147 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763378AbdEXAed (ORCPT ); Tue, 23 May 2017 20:34:33 -0400 X-IronPort-AV: E=Sophos;i="5.38,383,1491235200"; d="scan'208";a="21089169" Received: from mail-co1nam03lp0019.outbound.protection.outlook.com (HELO NAM03-CO1-obe.outbound.protection.outlook.com) ([216.32.181.19]) by ob1.hgst.iphmx.com with ESMTP; 24 May 2017 08:34:29 +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=wS4GJcnpotdHSFn/xDUVQnYrOuqRR4HcuWcq51Wm4uE=; b=BXkSFtkDQqXFCJRnwb9tSUy4HIKHbQ7BHCBnelKEs++fCON98W7tfpwMTj+2boMXpjE3NkX8N3Gn7CaETGkD6Zhzb3RroqRZNRVVctn3345Vh2p5eFKJcTiBAleRGmoT2DpqO0rFe3c/9d22t0P1btQXevdz/OUXi+B1N9cnaPM= Received: from BN3PR0401CA0037.namprd04.prod.outlook.com (10.162.159.175) by BN6PR04MB0498.namprd04.prod.outlook.com (10.173.201.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Wed, 24 May 2017 00:34:28 +0000 Received: from BN3NAM04FT014.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::207) by BN3PR0401CA0037.outlook.office365.com (2a01:111:e400:51d1::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14 via Frontend Transport; Wed, 24 May 2017 00:34:28 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 BN3NAM04FT014.mail.protection.outlook.com (10.152.92.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1075.5 via Frontend Transport; Wed, 24 May 2017 00:34:27 +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 AA.43.45291.215D4295; Tue, 23 May 2017 17:34:26 -0700 (PDT) Received: from milsmgip12.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; Tue, 23 May 2017 17:34:23 -0700 X-AuditID: 0ac94369-166ac9800001b0eb-fe-5924d51243d0 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id E7.A3.18148.F05D4295; Tue, 23 May 2017 17:34:23 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , James Bottomley CC: , , "Bart Van Assche" , Hannes Reinecke Subject: [PATCH 20/31] scsi: Only add commands to the device command list if required by the LLD Date: Tue, 23 May 2017 17:34:09 -0700 Message-ID: <20170524003420.5381-21-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170524003420.5381-1-bart.vanassche@sandisk.com> References: <20170524003420.5381-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsXCddJ5ka7QVZVIg8MX1CwWvNnLZrGxn8Ni 7y1ti+7rO9gslh//x+TA6jFt0ik2j49Pb7F4rN9ylcXj8ya5AJYoLpuU1JzMstQifbsErozp nceYCvaqVTzdeJStgfG6QhcjB4eEgInE9kUyXYxcHEICS5kkVq1dy9zFyAnk7GCUOLypCqbm 1tkQiJqNjBJ3F0LUsAkYSXx7P5MFxBYRKJS4tK2DEaSIWWACo8S+Wx/ZQBLCAgkSk9YfYAex WQRUJR5NPQrWwCtgLzG57zOYLSEgL3F2y06woZxA8a5XE9hBFgsJ2Eks2l4BMlNCoI9V4tWF DWwQvYISJ2c+AetlFpCQOPjiBdTR6hInl8xnmsAoNAtJ2SwkZQsYmVYxiuVm5hTnpqcWGJrq FSfmpWQWZ+sl5+duYoQEd+YOxrtPvA8xCnAwKvHwJjioRAqxJpYVV+YeYpTgYFYS4V2+ASjE m5JYWZValB9fVJqTWnyIUZqDRUmc95zM1AghgfTEktTs1NSC1CKYLBMHp1QD46adCyctWb/O 9HvQm/QazbnuHIJLNktsNDJZXDhRdU5gzO/gV/dnBxYUv21rfS3oUvA9X4pn/vIVyoVRH5S5 e2MDpjsEpOnGGD9T9t7q+vV6nsmrORs/NHPnh6eH7fRcZnXVkv3LrfQOzV8LmU9k/T7LVPvz gK/JzjM9zA5+/o+D5BYVxgkJKrEUZyQaajEXFScCAMNQ8cFqAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOJMWRmVeSWpSXmKPExsXCtZGTTZf/qkqkwZMPEhYHf7YxWix4s5fN YmM/h8XeW9oW3dd3sFksP/6PyYHNY9qkU2weH5/eYvGYtuY8k8f6LVdZPD5vkgtgjeKySUnN ySxLLdK3S+DKmN55jKlgr1rF041H2RoYryt0MXJwSAiYSNw6G9LFyMUhJLCeUeLd+Y+sXYyc HGwCRhLf3s9kAbFFBAol7p8+zQZSxCwwgVHi2N1PYEXCAgkSk9YfYAexWQRUJR5NPcoCMpRX wF6ib6c9SFhCQF7i7JadzCA2J1C469UEdpASIQE7iUXbKyYwci9gZFjFKJabmVOcm55ZYGik V5yYl5JZnK2XnJ+7iRESFFE7GK9PND/EyMTBKdXAaHHe7n+jrLBIK1NRmeM12UdSa5auWp17 ckbdKt3LZSfty6d8em0R/c7gWu28QyZClx/Efa9vbcj3uV25594upf45YfGLg9gstrhfLGL/ q6FzentJ/9dPf5/bz1uz+Tv7yoOCfzaU220/He3ZEbKtc5mLVN8P3sAiRqP626vZTBtd7Dbd Px9/QImlOCPRUIu5qDgRAJR4H1a6AQAA 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)(39400400002)(39850400002)(39840400002)(39860400002)(39450400003)(39410400002)(2980300002)(438002)(199003)(189002)(9170700003)(356003)(8936002)(2950100002)(50466002)(2906002)(50226002)(5003940100001)(50986999)(6666003)(478600001)(81166006)(33646002)(76176999)(8676002)(4326008)(47776003)(53936002)(1076002)(38730400002)(72206003)(189998001)(5660300001)(86362001)(106466001)(54906002)(305945005)(48376002)(36756003)(77096006); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR04MB0498; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT014; 1:ZVsMGEraL1HnxOO2+ubRmMx0NM0zg4kT3n0gUuF/g9NSKOnuFluPC/v4FmNPMQDRhw/4P6GXgnwXIffWfDw19xHR+BBQfteV78/dMfAaHkET+1FY3ox/5rLYkR9OkFVySu4JF4k+z4rVSwcomxAHVlCyIUlRfVsvJhueISfhQwLpO6frSqFEQHTPi3VsvLgjAH1x+lBpUR48CpwIPHGPDiwcqPWGM3RS8LmssZrldYuKOkBhOT7BbYTjsmfQAIG96OfBVGBgYoiVTJR14B/3vOrtbaU/OzpGfb8z1fX0HtZ4oToIX2mXSQbq6zfaB2jaDz0EUoghYQJGzzKqZbxLQw4HqhrEW2lzzNHqn1vZOIvRVHJfl4KsSGotQNvkPiGl4FmXVw2O+B0+BB65E6wniBGTQK+n6jH0PIFJpgOPT1k/+nZiSuokITi/0i4CvvDU2vVzHVMgUiX3qb3ttQIW/kleUJkmxBsK11ld9C+abMz3cVpf+3l/jgT/DU6aOtkCLPGAJcKmg+rV/F8ZKOHXMXpIs7YVJ2it/vs15lkxeSs= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4a663a5-918a-4616-7a0f-08d4a23ca2d7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201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X9ftBap+G+bjd/h4W1nvPkolX44=; 31:l6Iq3dZemzo+eZ5wQ0QKapzjgbUC3ZMCE7Nov9ws6inM8siwqOc5a8RQ8TF9Vym1ah74Vi30dB3NUgGASs8Sx2Yy8+f7ZLazQYhZhL8+Vin46Nkq1pjrakSrCB2r4Y7jNBYbbYcpL4o/4d1srZWqEK0I0F8Wg0M+fCy63eCI9kK09J5kkW2XpG13VQ7EmPm8V7kIagNErkykKxAMdUyOGoofIBQC4m8XRPkiw0sq6U6CuwYUeyABjuINXdOlcFRE WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0498; 20:PlaU3KdDZBuzkPnNVBuP3LyaJI3R0z9DZGbesN2sm659I8bI3lLHrSzEaRxO/F2AUYEm+VPgccDYHywpUXywcl7ujFqzVZPdubq7oPan2XkPV+xUoOU26c/G9U50C3QS4QSKcVwHNCPiNfFq7pZsl/8V7pvMEg8nuL3lQtsNukXM0UeFNzpgaMVoefXcnyDjtp6g7UuyBT+pwUbN6yzLICpZMw8YNPkqEBx5FSuIolCSdIEOUFnijcbxLUhUTzn7HUJDVIafzqJtANioWh2d3bx01M/HMzKGCodhpDHpMHt4tYmF1ib6uZBcbv0gSHI1sYVomZi/jLX6bqFAaNB0+etQxvQTeZInn/w59HD0wVIwgmCCM8I4j2iJ9mKY+pYgiQoXdH6OEqRXZnfM5rfdhkQGDd9L3DjOuvSvqd11myA71bDi9ElcICCcSaWwr4dQzdOAG2VBOA6ZgfTMgV6XND19bc0buf+GP1z93e50fVKoMWovrqrjmcy8eM39AL3l X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13016025)(5005006)(13018025)(8121501046)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)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BCAF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR04MB0498; 23:SEpHtIBYPWcVbJr4pYzeMPm6iXsQltxMyOXir6cTZ?= =?us-ascii?Q?HjSTL6nGpE6E89xcfzy222Q0Kg+8/2ky4pZj6P+K6CP8t611DT8DHbgnvWum?= =?us-ascii?Q?a7QnFOzgaQOemlRJ6Y9Gkef/aXPZ0NCXHD/rCgEetcQJdL1L1CFNavpVxHOj?= =?us-ascii?Q?0sIm7LhtohC7twkXVzXB49ZTUB7of57MF+Og7KGhbcYbITZB4r1KhMJK86/0?= =?us-ascii?Q?AwvISmTdfLumfdLQtYxGBXU7lk1BT94MF1ITjKbAIRwuOsXn0cymBCFnB4p7?= =?us-ascii?Q?PDB4wv3DhnPBcLR2dmtQcXb4pQDH9jTjmfLZeNQoK1oNiWestr12jTZcyKBb?= =?us-ascii?Q?ZZhcqS/vXRIU0bW/MbyxGZwh9q07cEwbvQ2A4aqBXR542baOmlWW/X5haypG?= =?us-ascii?Q?ydvlpihXVyXUoY0Tm6tx8VTdktELlr/mldRCwEZLabZpAbFx9ai8A0EFKFMy?= =?us-ascii?Q?Wgm7MLZu+OEZjr8QOjW/F6cfSXC71pr/ZjMbeSybM27xQO7gbFJM9NkiJAva?= =?us-ascii?Q?iJFj4ptH6RvlnnvITQ8Kfpt5YWurAFfrrCvQp/U6MDAd3fgCNfO25fZNOgBG?= =?us-ascii?Q?86lcKXLCPkFzPbXaPgkXctpHR5if61Cj7plsNsD/RVcEguGnnjjF7Lsd/fOZ?= =?us-ascii?Q?vyIfpmUGJF1e/CWgWwx89oWBmKuAgj4BqpTm7ifgc6s/Mm7mCsyWZUJ3MP4z?= =?us-ascii?Q?DWfSaZElXmIxVen394C7j+vpLcJGchLNlKw4bYWjXScsnKHIeZFCqy9Es7EW?= =?us-ascii?Q?mxk4yimNNSehQiCNS8A4IZD8+3pQ47/QrGdzq+g1fUMKQUW6HlUXG33GpGm1?= =?us-ascii?Q?X++781BoqV2d0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4H34w76uJrhnFaIrElksZmykqdV1loz0XzRATtT2Xar6ks8dl8wzibZ6BLT2fPHPtfQWOWMolLCHk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0498; 7:NRwC0Vk+Nz400SFjcVRcbsldcjqF3dVAHOoSEnawEfjFyeoneQW+KiHOBZZRZ8LnwVn6YUXRixsL1/XNH4m0ylgyCeDcLqiszRkrQWCMX3uv7vKC+BIsRSaaoRVoWUY1AtbkAMp+uDTYrOuzc84t71Mt3/Ydp/TrpYl+iEYEQIiYmoWTMyfhGHNwBlMDmPP3azv0sZTEke5OFKviD0Od5Y2VfgsHBNIrAggh4fRbr6jfooCIMRmOJ+9+UGC6/tX4wogZ+7QjtYO5SyEaiszGwYCmYxxGXMZzPT4q3GB5tG+2AXkOHqPhSzg4gvKz4Cjp9sUqtoZXRdw+bXN1/0kBWQ==; 20:bvbZvZszOvJJ/YXW9KSNAnBZC6rjBLMcutzk111afpgMd0sb0/6lhpHpezsdTINWrSl3t/cJaSdvfj7FkE69u5G7YsxI83WeAQtDRKUgDTz3fHHN+/FCQ5xycHAa0f9nV3V9gBYKslKTWTE7wftZalGvRRtvdoVcCDZtLKKfAOQ= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2017 00:34:27.4850 (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: BN6PR04MB0498 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 Just like for the scsi-mq code path, in the single queue SCSI code path only add commands to the per-device command list if required by the SCSI LLD. This patch will make it easier to merge the single-queue and multiqueue command initialization code. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Cc: Hannes Reinecke Reviewed-by: Hannes Reinecke --- drivers/scsi/scsi.c | 9 +-------- drivers/scsi/scsi_lib.c | 52 +++++++++++++++++++++++++++++------------------- drivers/scsi/scsi_priv.h | 2 ++ 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 7bfbcfa7af40..485684aafb9b 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -108,14 +108,7 @@ EXPORT_SYMBOL(scsi_sd_pm_domain); */ void scsi_put_command(struct scsi_cmnd *cmd) { - unsigned long flags; - - /* serious error if the command hasn't come from a device list */ - spin_lock_irqsave(&cmd->device->list_lock, flags); - BUG_ON(list_empty(&cmd->list)); - list_del_init(&cmd->list); - spin_unlock_irqrestore(&cmd->device->list_lock, flags); - + scsi_del_cmd_from_list(cmd); BUG_ON(delayed_work_pending(&cmd->abort_work)); } diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 31d2b9cd20e5..5e2f26524475 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -582,19 +582,9 @@ static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd) static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) { - struct scsi_device *sdev = cmd->device; - struct Scsi_Host *shost = sdev->host; - unsigned long flags; - scsi_mq_free_sgtables(cmd); scsi_uninit_cmd(cmd); - - if (shost->use_cmd_list) { - BUG_ON(list_empty(&cmd->list)); - spin_lock_irqsave(&sdev->list_lock, flags); - list_del_init(&cmd->list); - spin_unlock_irqrestore(&sdev->list_lock, flags); - } + scsi_del_cmd_from_list(cmd); } /* @@ -1132,6 +1122,35 @@ int scsi_init_io(struct scsi_cmnd *cmd) } EXPORT_SYMBOL(scsi_init_io); +/* Add a command to the list used by the aacraid and dpt_i2o drivers */ +void scsi_add_cmd_to_list(struct scsi_cmnd *cmd) +{ + struct scsi_device *sdev = cmd->device; + struct Scsi_Host *shost = sdev->host; + unsigned long flags; + + if (shost->use_cmd_list) { + spin_lock_irqsave(&sdev->list_lock, flags); + list_add_tail(&cmd->list, &sdev->cmd_list); + spin_unlock_irqrestore(&sdev->list_lock, flags); + } +} + +/* Remove a command from the list used by the aacraid and dpt_i2o drivers */ +void scsi_del_cmd_from_list(struct scsi_cmnd *cmd) +{ + struct scsi_device *sdev = cmd->device; + struct Scsi_Host *shost = sdev->host; + unsigned long flags; + + if (shost->use_cmd_list) { + spin_lock_irqsave(&sdev->list_lock, flags); + BUG_ON(list_empty(&cmd->list)); + list_del_init(&cmd->list); + spin_unlock_irqrestore(&sdev->list_lock, flags); + } +} + /* Called from inside blk_get_request() */ static void scsi_initialize_rq(struct request *rq) { @@ -1145,7 +1164,6 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) { void *buf = cmd->sense_buffer; void *prot = cmd->prot_sdb; - unsigned long flags; /* zero out the cmd, except for the embedded scsi_request */ memset((char *)cmd + sizeof(cmd->req), 0, @@ -1157,9 +1175,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd) INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler); cmd->jiffies_at_alloc = jiffies; - spin_lock_irqsave(&dev->list_lock, flags); - list_add_tail(&cmd->list, &dev->cmd_list); - spin_unlock_irqrestore(&dev->list_lock, flags); + scsi_add_cmd_to_list(cmd); } static int scsi_setup_scsi_cmnd(struct scsi_device *sdev, struct request *req) @@ -1874,11 +1890,7 @@ static int scsi_mq_prep_fn(struct request *req) INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler); cmd->jiffies_at_alloc = jiffies; - if (shost->use_cmd_list) { - spin_lock_irq(&sdev->list_lock); - list_add_tail(&cmd->list, &sdev->cmd_list); - spin_unlock_irq(&sdev->list_lock); - } + scsi_add_cmd_to_list(cmd); sg = (void *)cmd + sizeof(struct scsi_cmnd) + shost->hostt->cmd_size; cmd->sdb.table.sgl = sg; diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index f86057842f9a..c11c1f9c912c 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -80,6 +80,8 @@ int scsi_eh_get_sense(struct list_head *work_q, int scsi_noretry_cmd(struct scsi_cmnd *scmd); /* scsi_lib.c */ +extern void scsi_add_cmd_to_list(struct scsi_cmnd *cmd); +extern void scsi_del_cmd_from_list(struct scsi_cmnd *cmd); extern int scsi_maybe_unblock_host(struct scsi_device *sdev); extern void scsi_device_unbusy(struct scsi_device *sdev); extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);