From patchwork Tue May 23 23:48:40 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: 9744477 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 DFBA560380 for ; Tue, 23 May 2017 23:49:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2F7E28818 for ; Tue, 23 May 2017 23:49:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C79EA28854; Tue, 23 May 2017 23:49: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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 425B128846 for ; Tue, 23 May 2017 23:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030861AbdEWXt6 (ORCPT ); Tue, 23 May 2017 19:49:58 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:60965 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935008AbdEWXti (ORCPT ); Tue, 23 May 2017 19:49:38 -0400 X-IronPort-AV: E=Sophos;i="5.38,383,1491235200"; d="scan'208";a="122509187" Received: from mail-sn1nam01lp0118.outbound.protection.outlook.com (HELO NAM01-SN1-obe.outbound.protection.outlook.com) ([207.46.163.118]) by ob1.hgst.iphmx.com with ESMTP; 24 May 2017 07:49:07 +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=D6Z0O//mPofzt9eSZOMkM2whuKBt+R33DQNwIZUpRWg=; b=EJ3jvSbkStigFj48KxODDjhr7CnY6+9lOAGnSXihfbu+v8GTdYSqvRFWGvsyIJYz6vtK10rsh43aTB40NAeoGdDg7uiwZYnKJG2n2/UGLKRuxmtBLzGkGEQADdEDv7ZZnfmsXeYH2IuCqZXVepwxdD7UR9onqAE/B7o+7ixJ/v4= Received: from CO2PR04CA0116.namprd04.prod.outlook.com (10.165.95.18) by BN3PR04MB2307.namprd04.prod.outlook.com (10.167.2.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Tue, 23 May 2017 23:49:05 +0000 Received: from CO1NAM04FT024.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::209) by CO2PR04CA0116.outlook.office365.com (2603:10b6:104:7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9 via Frontend Transport; Tue, 23 May 2017 23:49:05 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; linux-iscsi.org; dkim=none (message not signed) header.d=none;linux-iscsi.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 CO1NAM04FT024.mail.protection.outlook.com (10.152.90.105) 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; Tue, 23 May 2017 23:49:05 +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 DE.64.19026.F6AC4295; Tue, 23 May 2017 16:49:03 -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 16:48:58 -0700 X-AuditID: 0ac94371-41ba798000004a52-0d-5924ca6fb062 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 4F.F2.18148.A6AC4295; Tue, 23 May 2017 16:48:58 -0700 (PDT) From: Bart Van Assche To: Nicholas Bellinger CC: , Bart Van Assche , Christoph Hellwig , Hannes Reinecke , David Disseldorp Subject: [PATCH 19/33] target/tcm_loop: Replace a waitqueue and a counter by a completion Date: Tue, 23 May 2017 16:48:40 -0700 Message-ID: <20170523234854.21452-20-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170523234854.21452-1-bart.vanassche@sandisk.com> References: <20170523234854.21452-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHLMWRmVeSWpSXmKPExsXCddJ5kW7+KZVIg8MrdS2+/p/OYrHgzV42 i5WrjzJZtK0+w2jRuvQtkwOrx/3tR5g8dt9sYPNYv+Uqi8fm09UenzfJBbBGcdmkpOZklqUW 6dslcGWsXNPNVtAtXNHy8j57A+M0gS5GTg4JAROJHzNesncxcnAICSxlkrgY08XIBWTuYJR4 17uBHabmzO8lzBCJjYwST27/YANJsAkYSXx7P5MFxBYR0JGYdfcFO0gRs8B2Rom3n7vAEsIC kRKrfm8Gs1kEVCWmb5oHZvMKOEjcXbuPEWKDvMTZLTuZQWxOoPjKPduYIS6yl7j8XRlkpoTA NFaJPbOfQPUKSpycCWEzC0hIHHzxAqxXSEBd4uSS+UwTGIVmISmbhaRsASPTKkax3Myc4tz0 1AJDE73ixLyUzOJsveT83E2MkFAv3MH4+rb3IUYBDkYlHt4EB5VIIdbEsuLK3EOMEhzMSiK8 yzcAhXhTEiurUovy44tKc1KLDzFKc7AoifNmyU6NEBJITyxJzU5NLUgtgskycXBKNTCGFiiq xVXK8m2UT3UPZ/ls0xXfpdKUZeg671B6XviXq7pNC2yTRQqEBXun3K3c9fnn4rsrTF6mHd/c cPXnzL+Kbut+v7HSOLBv/uyX4cU7GSye6oUoO/363BzI+zwzN1w07U7UbIMFaidvfVqaGe4n 6Hi5hl9wdQffTiYOmUD7cAu1mOPFM5VYijMSDbWYi4oTAetHd5xxAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHJMWRmVeSWpSXmKPExsXCtZGTTTfrlEqkwe9TehYHf7YxWnz9P53F YsGbvWwWK1cfZbJoW32G0aJ16VsmBzaP+9uPMHnsvtnA5jFtzXkmj/VbrrJ4bD5d7fF5k1wA WxSXTUpqTmZZapG+XQJXxso13WwF3cIVLS/vszcwThPoYuTkkBAwkTjzewlzFyMXh5DAekaJ 40dusYMk2ASMJL69n8kCYosI6EjMuvuCHaSIWWAno8T6v2dYQRLCApESq35vBitiEVCVmL5p HpDNwcEr4CCxYmI5xAJ5ibNbdjKD2JxA4ZV7tjGDlAgJ2Etc/q48gZF7ASPDKkax3Myc4tz0 zAJDI73ixLyUzOJsveT83E2MkBCJ2sF4faL5IUYmDk6pBsZllvlqyUaNHqKH9jyX27XnyLNv NrIva+Vlj9859P54S7/y4g6xzpU8/oovzkWf/PU5UUFpsrFbbZR9Zu9nnUKD4Faxo6v0nmrI 3BAykzo7z+exvPt79uVOSf5HmI34r30vWO471at5/+IjrJO7LbxvOYVZLMvv3L5ZZ6te+vb+ 143z3ademKDEUpyRaKjFXFScCACuLFeIwQEAAA== MIME-Version: 1.0 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:(10019020)(6009001)(39400400002)(39410400002)(39850400002)(39450400003)(39840400002)(39860400002)(2980300002)(438002)(199003)(189002)(9170700003)(50986999)(2906002)(76176999)(110136004)(50226002)(356003)(33646002)(4326008)(72206003)(478600001)(86362001)(5660300001)(38730400002)(47776003)(189998001)(6666003)(53936002)(6916009)(2950100002)(8676002)(81166006)(5003940100001)(50466002)(54906002)(48376002)(36756003)(305945005)(77096006)(1076002)(106466001)(8936002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR04MB2307; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT024; 1:UglIqk6+NK7eYWtK7JT/UpeahYv9R1oPawc909sE6iIiLydSf28XRY63xB7NJeYNlzF9zEZW7/PWk9KnZM4X5aKz/XL94xTcv/MvVOgpj3gHcdZ8biYAuTHiiXYHX6y/BdcDsVgxnAdAlWFV94T8Cl7xhR6Fxni7svMb/ChE39qudntxcBr5diaqxMx8xGz3flgT9Sv1Ld8TjNXNhxsdpAxvfsoj1Erdy8pw30+SUUXkQHxe8QF3ifHnWcRT8r9nN3Is/R8sV6+V35Un10nsUOrTYjn4htLL37I2G6SsIB+uQYDEwjnAYpL7v/8x1iPriSqWi5OGZKUNsvJ1sLdbAiCnDUHupVzhRR9x9Vnk2bYB86AxMzkPaUnyz+Ngps/qfs46iIyqZ3gFsTafG3LJYYigDqXdJepeQabYBDQLWZIqIYUT73mXdDpqo9fVX79AVPYmPpE7Aj/dGHS2nX67dFDxyLTan2HhvUChveJpyYSYObO9i3omYWrsHTDkk2fb X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PR04MB2307: X-MS-Office365-Filtering-Correlation-Id: f89c2c01-554c-4763-a7cd-08d4a2364c0c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BN3PR04MB2307; X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2307; 3:S26xd5RlSi4RT2QuNwO1gKXSMTjzJP3BL1z8Z10zzRKs77IS3i4H/QRQdCum2K3C2Sg2xE0/UakkN5kqt5uU8ZyQ37VYl54rPmDlmsk4rH+DbP03GqFEbzoMe/O2Ixf+XujSqd5wpI1/B6FuSBSJa5HNxpS7qOAU1noVQ/J6r0hIPJIHN7I+VfiB3zDu4k+tpNFRaDqFQjTkwvazVvScJCq3AABUVXE4yULvjXKBshUj7vNEdEe47SvsYOkME2CTMhlmHRQ08kcCeNqFY3gBvC9616bjRBAVm9U9IqltKD9SJLPDwGHZ8S5mE4fS696kba9VQxp7ZFevHsASU3mHw/IvgHg9we+2EBoWJrpE6qG2WJvovrqM7zMITK//XJAB+fnk0PHPE3W9dYHbhIv7tf53y1rHCOCSV/ykZKhY109ScQU9KMQXqdsy72I+hpQUKBz2sGHlbTLVzCszFHVF345qqsbPw8lPe/UjiKClaRIf+d+7J5CHHx3dYz+bxWAMl1rNyqT4j0EpewAzebS2Lw== X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2307; 25:SScXh0wIj//Xz2KGM0QdaLOflWb72J4OKXoghAXPr55FacD0wxOgSDljvhtvXnzmbm9xLxEacUqJwCSlKild5SYjCrAn4DKdAI6tNE8Ev6pNS9vZTGr8Mj1eKPle2ScL3bau3ScH0FP7wgWcYILXQG4zZDI0WCR4EtHYDwBrGyMTNpf0tRfIyE0OVD1CqKmbz9JnGLI4+EQbAArTAgGXUaJ+l0SiJ51ppM/0M57KQksMGv0OKjFXgd/JFtNKiw6tdW17814mbxFvevJnnftKavg8N08WGCm6RYUBVja6u6PYRiCFAN5VoewyHKnjnQQJO4bcsKh246U6SwCvMQHU0iesp0hTqgWR5D5HavyvbYHR7nk7ED7cr9f2CexPdsbkQ1i3oF9QPwTvV6vVtzh18NM1De7mTuBX8WRCZDn0Vt+CaGdutz48+81quZ9NxnQSwKgLM7VOGkEJJldS3D5hx+uMzyNBeQ8GHkRTGWBSJ/k=; 31:HPZQLuoAvmAetTd41Xw9T8+7KhCVSacG/6MqL7hLuegsVYS7TDYd5sOWkrr36KJsgIYJuTV0Ux0Bx+WH/Bn+/7otRb+tp0iWNT8QRbybvDMm46qlFUyNGHcHkYFcJyxhDLAclZlmpgGKqFG98uwDiFn4Sx5vjcI3z6noTLp0AAyEvE7Z3ygGXLO9ZmAz9DTzqlHucrAtGQNoLMMoNtboDUOiLyrqqBIr8ji9lb75mU9c1uG6Zu1QNkCZPz738CtQzd7uFf88CkyoRqe6ViqXsA== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2307; 20:K4MhbwE+J6x3NAstKM7TQPr+KvnEmXxJec+yrzU4QR5WmqrshMdElJhatChtzjo8ch8xzYfOkx7IPlEtaQEsNXDnGIFbhGYQt3qSrbNKTEw1qBNpKWYG/W3OjjDCJqBNRB1lvO6svJq8coRpryukvTx/usQIEEHp6J6yhEc9SOxKFAggdv+OKoPtbM6zD/hWRMcLR6zU/+ljeTSl6g30O0fXOM4g9cINpjLNhJzqpn3LDcw8PxMcZ8Od1z8oa7uPvaleH5E1sFTKozMLVhX44+iGs0xMo3efayQteX+qST1qz0HXuwnFYwQO5RzIuS909dP/1Zkm/QCMFHC4ZmjdtL8MMmLzibko61TLQYCJpoAFhxHP+nukV9VB6MgPfsxRpQqmL2QAfp2vpI4WE4s7PlCi/9x10I/PkVhxBsmDzM0psqruTFuWe+L9PTq5vd1rWGAKGinxouiDVOz74j0QezXT68m9yuRB5jSLe/NdctTq7zShAKvhvROcKt9hFaEv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13016025)(5005006)(13018025)(8121501046)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(20161123562025)(20161123555025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148); SRVR:BN3PR04MB2307; BCL:0; PCL:0; RULEID:; SRVR:BN3PR04MB2307; X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2307; 4:Pzw2VszrrDhf1E8N+JLmvmCKcOAfWMPCtAJOK8q3m4tMCZmydd0RaWZnWhFTOMfpkpLVRw+SesKoeLRseJHMTAdRzJ0fZtrjInqyC2EnMxSABkU4tBNMGSn9uovapv8PDFQ4PHQ41pajPBLsDb0x49b23jmsLAMOMa7m8UexVoRTGj4E8VK/baKDMoSz9Yi2cOBBNimCE0dYBoMecs0wSVnDoXKXZFNZYxR5W1G1AAagihc/xHLXrSXA20slghPclbkS7ThGWK59ebbfnujjs+IxA3SEpYEpiGyPXtp/lawXIHqTLtGV3n6wwST0HbY+c2FpnKs9o4fDn189X1nyTlHhEQyOAm+X5PowqIqxuUjuueGjE+d04OwoGdRmIDPQjDgnvkchvnkQq0DDUmHWhIFFFL/q29q01vqGJ44mUO9rCWuGGffqVA84Y68NCtb0Ho48tvPOnpWG0pcCvDEcxZl1VqhwppzHaOoQSLrOi3KnR3WJntn1fID2/OY52S1SusUD3SatES5cN9vmZWhOrqGT93VFSuib0H82trfYVbLe5R7eC2Vo3h42PRhtbtpiIJ31tsCXLS3I6VGYmjCIMIG0Ka8ZLS+P2FiqDM5Hgw6PJ9+Xw23C5Qf5X2UvuCwd96kywSVlPLV/G142JlAL5tMaLN88Gy9B1hwzPSBQOOngFdAOr/tabEFCm/rmFT1GxTunm3Qrr6N4l+iXHi72jV/PqaI4hYloCk477DsAnwJ8r1SzmZ5hNGc02cGhI3nr2BGpEZ5fj0LigNFv28XAxyfQoxUCpZVkn7ihGnqyxMdVQvvB6dhdfIeAViw9RWmLw5oWbFIMKIyNY/QkHz10wZZutMR6QhdJhUKfVVZJSTsidSDPMFSh/o6GCHBD20rvuH7ymnMMprl+BWWvxbtEVgFe5pmfWZefIHfLJpG4Fp 8= X-Forefront-PRVS: 0316567485 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR04MB2307; 23:mhkppaHwrLfsbbb43i7EVkLPBle1DQtEugPk13EdA?= =?us-ascii?Q?Z5NCP46V6vSexP1+XvQvv0RYdE95bGoCw4jACD1Wvrghu+VkA3IyxjxKhwIm?= =?us-ascii?Q?8DM7FyMWa4n31Lds87veTXPJscAaBjGLt+KKOdaUZsmwTAA08mALf6v7ltRD?= =?us-ascii?Q?0C/SNLs2eDcuEenl7p5aYgRdfXpQhP4Nobihu+xMhWvSGY/6Hwv8/ORJ0y1c?= =?us-ascii?Q?lkarRgZryBtJ5Mh46i8DSqIUnwG/OjfY+eGGBbNPs4mJLRvfkNB1GGqyKQ8i?= =?us-ascii?Q?yDt9cwDygZi1kBAbpF4HxEKMIe1ZMZbfuVTV7+/IFoXMx8yL01oWzIZduvZf?= =?us-ascii?Q?exSVlcLjz7hb9cQN+7MjFZBXrVEJ4gNEOqGA31UZ9gc13G2Yt/NVmQ8VGHMg?= =?us-ascii?Q?fjf9MSby3SG28eDBWS9wCXS60W+0pHyfE9neme7zw0P91ITuqxDHY466uwlG?= =?us-ascii?Q?4MHRiLPwWDTtz/midMcZTww1IsemwkitipRx0e+gQOhMJZXAdHnzoK7f95e7?= =?us-ascii?Q?8Uvg6eEv26/tPmNwDBk4M0/WmQEbj+nl7Q0CeVBZU+b9XOU1mgjvsrREsQmc?= =?us-ascii?Q?19qWr4Oa+Uv++0TY846dKVGfloGVK3wQWgmgh0JMesseMBeZwUDNAxF2swNG?= =?us-ascii?Q?2kOlmQaYu86D5+jQ+Jla+IAdQZPDsMAC58gJNnb9aLNHQRkszDgXmDQyvjZi?= =?us-ascii?Q?mXjgiFPlgEFF1PdbUGKSWSo9e6Qae85Iotg7UghzW1dFoVd4Yxl9bTlKGOZj?= =?us-ascii?Q?eWSZeuUiaQtV6hTbjEar5vm8cEtcqUymlUjYf3OBijRPq0zXhiqCqyWbZeim?= =?us-ascii?Q?XzlDpGN7SkUsrsxTUis9oylQtR8f4Y56xjBwtrghUgtUpUWC691dFFkeMCUN?= =?us-ascii?Q?46OPIhSgwbqImUlRqbnLau3eaTJp/JeDLnM06POOlmFeaNYFEphQG4YdPthn?= =?us-ascii?Q?/DwtAfVkQaXZeN184C1C9pGc3Fia2gpEXhxQtQv2RDYfuQoLRiiWmmMKymYJ?= =?us-ascii?Q?fQIXpH3C2ZFJTNcq9VGuUP2XTENYNaND4aHbvqi5y2LoJifabyl4S2WA8k/e?= =?us-ascii?Q?uWMEJ4AaDUGc7YZfjl9f+5+Dz1T0Gm8iAcSmKGHBVTHVobKJg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2307; 6:9Jh1uQ23gE2f9FQozB2WntUgEXrHn45Y/1ER9miQ9G7yJQu+15NJi+k5ymRt1oxl5Qg1BCy7aDW6xvxEQod2Z8b5Kkq4VNhK5A991eRT807Wu8dHBY+eJ2MOZoPkFZpw4n1tDfZSbN15LISGxVEfhLl88NRE/A4jn+mtludlNIRk+hRTnmABqk/+YSb1i3KQKGQ1uZNjwb6/aLjcgPV7mrgCpDLeEIhHzPzxpV1HzQ5+gcO6TzFmhDreoAcUCC5XkBOgfC5q9lxhEAyGaSW8JRKlgNr1wJJUKU9wzPkLUShT0M6xBMBpTAbb0yiRHA3lC5MJzMJUtWC8ePepz21PdstyG2LKP4UFn694PqeYlDme5qKnwVcUnEKaq2M8YKD4XxmupDKNUCSegiqOamk3OGU2dfg8cOKEKY5s/lefPT/IKmZ9bG4MUqzlQ8BRdMA0Qqe+y2accyBH/W736q/7AICxgxazix06YqI9yTbw8hv0skpPk2zX9xyZD3WWMKITDwXS0kkRAjdC64WMCreB38+wh/HX8ez2OjQYYfNswyw=; 5:mrTO4gGQbNwBJYcW8IBqX7UGilAFH4xWOoHJNRm72H+3veGxwRdUv2D9bB2H029IUinAxUZaXjdMR29/IRkq9JjubN2JIlLklPdDt26h4N++qNEt020lVDg3IJP5abLzrX2uYQ6KMvVnBBhZVZzomw==; 24:1bOnZ3xkb6yajmAnFFygNs38EcK6rBF5ryrpvIYlNy+8kZPoR8AJXHOFcWMytz2M8GOpfl3ikccCK5DO2XeQa1aCjhm2JVjx9LP4w2tjLzU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2307; 7:Yo2ot1boj1xb8ghafQBiEZdn/TMEFSuTWaEif2JamgzijNDYB3DCBdaA4IbtEL1vQAQR92QspI6rJrRdmd2s2CM8J77SvwAnL92KLwq7N1mO8vAYLDcXB8BirdYRWeZ0fMsRFKsZJxoXa+aZa3PIS3X1gAgCmJM411TpW8qvtF1cuBzEnrGNkKB6t2EJR9euCOU0LIkwXkt14u096y4a3yM7y5/cqAdAstEMGcyzgR46vieskUwQNn/lvJ0ahq6b/OuM+s6O/ofHH6Pz6Lx0Ap+w1Gzc6vmyBU/odH5k3sK4f8h6nVHGin4ravHa3mVNdJ9D+QctF8OAYB0Xsx5ZLw==; 20:UTu0gDC7GAtOYvVxEEIRjn6p7A70FwQ5mefJq5YiWzWIReMPVs+9Scnj+oe17FQQiHw3ByUtVoI4MAHp3/XEXPmmQV18ZIYqg9byO4mEt1SzbWyWvSACkZLdsg/Dk+t2t7ELTJ2JTrZVg+EHjyEx0SyI6u3PVzj9ZvkGjZK7xEs= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2017 23:49:05.0619 (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: BN3PR04MB2307 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch simplifies the implementation of the tcm_loop driver but does not change its behavior. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: David Disseldorp --- drivers/target/loopback/tcm_loop.c | 12 ++++-------- drivers/target/loopback/tcm_loop.h | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 79776b447b15..27f912747113 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -239,7 +239,7 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, return ret; } - init_waitqueue_head(&tl_cmd->tl_tmr_wait); + init_completion(&tl_cmd->tmr_done); se_cmd = &tl_cmd->tl_se_cmd; se_tpg = &tl_tpg->tl_se_tpg; @@ -270,7 +270,7 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, * tcm_loop_queue_tm_rsp() to wake us up. */ transport_generic_handle_tmr(se_cmd); - wait_event(tl_cmd->tl_tmr_wait, atomic_read(&tl_cmd->tmr_complete)); + wait_for_completion(&tl_cmd->tmr_done); /* * The TMR LUN_RESET has completed, check the response status and * then release allocations. @@ -665,12 +665,8 @@ static void tcm_loop_queue_tm_rsp(struct se_cmd *se_cmd) struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, struct tcm_loop_cmd, tl_se_cmd); - /* - * The SCSI EH thread will be sleeping on se_tmr->tl_tmr_wait, go ahead - * and wake up the wait_queue_head_t in tcm_loop_device_reset() - */ - atomic_set(&tl_cmd->tmr_complete, 1); - wake_up(&tl_cmd->tl_tmr_wait); + /* Wake up tcm_loop_issue_tmr(). */ + complete(&tl_cmd->tmr_done); } static void tcm_loop_aborted_task(struct se_cmd *se_cmd) diff --git a/drivers/target/loopback/tcm_loop.h b/drivers/target/loopback/tcm_loop.h index 21340781568b..3acc43c05117 100644 --- a/drivers/target/loopback/tcm_loop.h +++ b/drivers/target/loopback/tcm_loop.h @@ -16,8 +16,7 @@ struct tcm_loop_cmd { /* The TCM I/O descriptor that is accessed via container_of() */ struct se_cmd tl_se_cmd; struct work_struct work; - atomic_t tmr_complete; - wait_queue_head_t tl_tmr_wait; + struct completion tmr_done; /* Sense buffer that will be mapped into outgoing status */ unsigned char tl_sense_buf[TRANSPORT_SENSE_BUFFER]; };