From patchwork Fri Apr 22 21:14:43 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: 8915671 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C6B429F372 for ; Fri, 22 Apr 2016 21:14:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8B16201F2 for ; Fri, 22 Apr 2016 21:14:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6E9B201EF for ; Fri, 22 Apr 2016 21:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752053AbcDVVOt (ORCPT ); Fri, 22 Apr 2016 17:14:49 -0400 Received: from mail-by2on0090.outbound.protection.outlook.com ([207.46.100.90]:60100 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751742AbcDVVOr (ORCPT ); Fri, 22 Apr 2016 17:14:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4u4F4Q0sPa0+/zSp2PFCBIdilS8pIphTN8nYCBYZgso=; b=GtvRHixlLrrXgEyR+3pWDTL3KD6lzCgCD4M8RNPU9jW15Qj6yExufsOBMbWNYq0IR63zh4NdQ6QiKlbLOD0Qsk2I4lsHRuNI9fDVHV8vdDDcI6uJx2MLOZfbWZigo+gbHmkDG28rUEw1e3f4ebcAtQ2wFJZBhtkJvhsWMO+sW8s= Received: from BY2PR02CA0116.namprd02.prod.outlook.com (10.163.44.170) by SN1PR0201MB1934.namprd02.prod.outlook.com (10.163.87.156) with Microsoft SMTP Server (TLS) id 15.1.466.19; Fri, 22 Apr 2016 21:14:44 +0000 Received: from BY2FFO11OLC010.protection.gbl (2a01:111:f400:7c0c::138) by BY2PR02CA0116.outlook.office365.com (2a01:111:e400:5261::42) with Microsoft SMTP Server (TLS) id 15.1.466.19 via Frontend Transport; Fri, 22 Apr 2016 21:14:44 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; 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 BY2FFO11OLC010.mail.protection.outlook.com (10.1.15.21) with Microsoft SMTP Server (TLS) id 15.1.472.8 via Frontend Transport; Fri, 22 Apr 2016 21:14:44 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [172.22.12.162]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 4A.65.04010.BD39A175; Fri, 22 Apr 2016 14:12:59 -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.279.2; Fri, 22 Apr 2016 14:14:43 -0700 X-AuditID: ac160c71-33bff70000000faa-b2-571a93db0308 Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 61.41.03935.3449A175; Fri, 22 Apr 2016 14:14:43 -0700 (PDT) Subject: [PATCH 07/11] IB/srp: Move code out of a loop To: Doug Ledford References: <571A936F.7040409@sandisk.com> CC: Christoph Hellwig , Sagi Grimberg , Laurence Oberman , "linux-rdma@vger.kernel.org" From: Bart Van Assche Message-ID: <571A9443.6000600@sandisk.com> Date: Fri, 22 Apr 2016 14:14:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <571A936F.7040409@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsWyRoxnke7tyVLhBucmiVm8PP+B1WLl6qNM Fs8O9bJYnP/wisli3ev3LA6sHufvbWTx2H2zgc3j/b6rbB6fN8kFsERx2aSk5mSWpRbp2yVw ZTy/cp+t4CNnxfLfAQ2Mkzi6GDk5JARMJBp6VrN2MXJxCAnMZZLYsmEpG4Szg1Hi3PMHQA4H WNWZT6YQ8aWMEmc2PWED6RYWMJPo3r6KHcQWEVCT2PRqEZgtJKAlsXTib7CpzAKrGSW+LHvF BJJgEzCS+PZ+JguIzQtU9HDNfbA4i4CqxOOvE1hBbFGBCInV664xQ9QISpyc+QSsnlNAW+J5 53xmkIOYBTQl1u/SBwkzC8hLbH87hxlkl4TAJlaJC5d3skIcoS5xcsl8pgmMwrOQjJqF0D4L SfsCRuZVjGK5mTnFuempBYYmesWJeSmZxdl6yfm5mxghEVG4g/H1be9DjAIcjEo8vB8aJMOF WBPLiitzDzFKcDArifBOniAVLsSbklhZlVqUH19UmpNafIhRmoNFSZz3YvTHMCGB9MSS1OzU 1ILUIpgsEwenVANj1rpVdyYea3tg0zQneeHfZ5ZZ6Z/mnHjFcLP/bda2Hye4X4e5PimaX//R I1fwRN3OaYvmT5lu8DDqQpH/ot3rBHZ+2iDtkvz5yG6VFyLTv8/7JLNQQbd1YeROQ5HmlJiW SQbcT9Sclk4yDM0omiWYvpXTNNuS4fFOqVWihjLcpr9bBOKDTRS0lFiKMxINtZiLihMBalVF HYQCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJMWRmVeSWpSXmKPExsXCtZEjRdd5ilS4waQTrBYvz39gtVi5+iiT xbNDvSwW5z+8YrJY9/o9iwOrx/l7G1k8dt9sYPN4v+8qm8fnTXIBLFFcNimpOZllqUX6dglc Gc+v3Gcr+MhZsfx3QAPjJI4uRg4OCQETiTOfTLsYuTiEBBYzSnQse8zWxcjJISxgJtG9fRU7 iC0ioCax6dUiMFtIQEti6cTfrCANzAKrGSXu9f1iBEmwCRhJfHs/kwXE5gUqerjmPhOIzSKg KvH46wRWEFtUIEJi9bprzBA1ghInZz4Bq+cU0JZ43jkfLM4soC7xZ94lKFteYvvbOcwTGPlm IWmZhaRsFpKyBYzMqxjFcjNzinPTMwsMjfSKE/NSMouz9ZLzczcxgsOSM2oH4/WJ5ocYmTg4 pRoYWSpXKs0U/bdway/rF9dJqfOa9nypKNz1Vj39ms0tU/9zz8+t+lMfsrk+SWna9kbGF1Iz 579d/ptJfc6t7bZ+PqGbbwVqPL5/LNVvysqTR3qfhR2K01zpb9TNGWF4by3/tj/ujMdXzYjO c/GcY72eW/FkferKy8rs65OV3abFWrFXWZ2SLvkar8RSnJFoqMVcVJwIAECSiCH7AQAA X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(53416004)(11100500001)(4326007)(36756003)(586003)(2950100001)(5003600100002)(1220700001)(1096002)(65816999)(23676002)(50986999)(76176999)(33656002)(81166005)(2906002)(106466001)(54356999)(77096005)(19580395003)(59896002)(80316001)(2270400002)(229853001)(4001350100001)(86362001)(92566002)(50466002)(19580405001)(64126003)(189998001)(5008740100001)(110136002)(47776003)(65956001)(230700001)(6806005)(65806001)(87936001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0201MB1934; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC010; 1:16BULLQykPsotGBXuHMfat7qty3sW/ZyN0iwPjnUJDbUfqkqczAojrCfwu3jCg5hj9x+ckh7/rvc3zJ0e6Pvvf8AwhYRpX2fyeiKcuOlwbhKgd5xU0zH6NfTZTKZke/I8guKmYXR1euQe4rILelViTS5T3PZ3zlb9hXUvmxtQjuNyl4EYmeT2W7V2xZouWadBEonGwJ0F0fXv/FLmMqSRVc9nxzx0oa1I6BdmK48rluNl3N0tSzcu17balhkISv9xLUrg6llP+i6ZwQk/bjcNcOhDAX02nCYn4HfkZyRffV8vLfQ1qPpJee5IAzmpZXSWoSqWL15WvhapeaMX0ax2hlW5koSd1RIF5FLCfLWXrfrQ/eOeXEjTqY38vVvGckD2Nlu95V8rpKZ9nWuQmuUxtZNMlZsJMdF2oYCQJ3avvrQTYS57wMqp2dgYdbVE4Woa9SMLWwGqNBbdJ3RmNYR/cJJPojsK6Afl+bUdr7kwI8= X-MS-Office365-Filtering-Correlation-Id: ac3de2be-97c5-4d79-6a6f-08d36af3204f X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1934; 2:5t/xw+Y3TJ2puo3fVL/lpAfNLSgA+MBOEtoIhjISQXQcAgwTVES76g1GvCpyTy3I5CUTeOwwhIpYCZBU0mj+2S+EZCfbSPJsmqPPpziPTwh4uCcQe2k7ylTDEJh8ltuD2O3IOOGxu8L/0nW0FGGOB+UFS4xtqZDaK3gc/rxME8RVUvukO1yVvHc1z/QlB6Zo; 3:nRzt/Fh1J7stk6IGLaWxXUQhf6Na0yS5TBMaJGWr21FRqd3UvyZyDFrZvzOvg6L3XSWg4qpyr+NPlpTdpFiY4qKJK4rD0p34FZ01STNTIcjOW5Wnl7pZwlFRAZnew5SWU+BYhGswk3bbqLS/qvmG11mctLgcbRGsS3+fcHecl9fTJrEw2trJHNqOWDxjZDRzWEgmCHHOrFKwaZIU7L+S2M18C0+bQipnneVgZZrJ3pklQPpSDaJ1kbL/31M5yB68N8itQaKtkL+qXwUjDpudhA== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:SN1PR0201MB1934; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1934; 25:55+RPIlosGgJ7iCZN/I7/sSDDM+1uC9ZCWI0IVnK006aG539VMKA9XSRCQGHkWShrmw2Ifrs2aG2+327FKfP6xmdsY31EyPgIWdXIiLckr40sI5IEfUubHugTlrvjQFADBdWi7s6Xa0NXIv9/lnldNjRZO8pU8fKgmlNL4hhe9/ioa4gCGL1pX+V/fE7YhVCp+1PqLQrtOcbAjS3BH1RNYf07YSXku/0EbpWtD19YsIewxe6ld5PGcIygPhxCYRs7JU8DsLqUHHnoKi61fAlgyvOBJfJ49K+HMEEVd7b2MWP0om8MJO/FHY65xd2potNc2L83w5qG3Q46gfSoFz5E3TTd/+utOsW7mARuBrBC9es+2Dc63LuYFzGMIZg0WER4yJdlJsDun92atJ7viyMicBuXcY7R7uA6yaCvYNE4ldbQifmK669+HmJbA+iJpHu/vBgAgmRJQ6yzBvBQGUA7eLn0LaAyoqbeKDpNF36HtoHK8inX+KOrGTzPY07Lv8Osm4WNemBHszxjAQiX7ZZwe59WABsoRvopypbWz+7Wdy9fJ43WVa7ilcIn938DOiMhXcppce8fyMaognOYO/luQ46mIs7EILobp2qCPzH5amRtWT6TiK88DGYOGzJ48w/t3CjPEk6py31MV5+OE65Tzg2WZ4uzk2BCV9iIO7qfFrZhBcDWcY25jwtcPVisokt X-Microsoft-Exchange-Diagnostics: 1; SN1PR0201MB1934; 20:x3Fu7eCfilnoue2sEEXOfj1Q7uVCINKMW8CaeBXI02FDeAxvQoc/DQziJhq8VD3UfCvEPOTMbx2nYl8nyCYyWB4Ktd5rndUs9z7EGgMiF696ipDMbs5tn0GAxBoh/3prAR9AZgiPbcupleVEn6RqIa+fU1N207R6oBtC9TjrJUG4CbqBy6Rh3dLYT7Wgo4maPdnVp2C6hpEXq6rwUmDmRLeIT5IOsO1z+FVaAenCtefE+tl6lrDgzA9sMSs53BzgpKwIZB2Hg5CTPkIQPM85n0zDGBWHteoBGPsSOH1pB9O9uUPoYhEPDqPHd4xXe0lEHSShuPWhf2I9+huFzbQApVXPm9tcqyWBmZeImfpTy/FHaT1a8im8FI1oDETZ/XflO9A+t4GnYeL9hnEm6F4DLANZxekMJ472bg3ckz3wzFzGTYs8HDN1vfVHlZIl8f7PrrJZ7hntzqmTsiokNtMN0wWdordD9LC3WD+O3F0RSB1NAB0ZMVMCCqLsd9vdsjgu; 4:Wjlp9j9RAUtWJPwd8SJLhwaeOqDyxU11htkpDETp/N6U/NyKp62yT9sKqdd+FSWWp6kyzeCrmTB9Ei1ydHWMMngnmMUbm520TT4HfjxWjr70EjJWJSH2iWgHtFMpKVT8HcClOeTje66VBbo/7EnF2Ari2fb4cOD6QtvMZOWYXU9i0qfnhy8L8/Ks3dDUHe19ufp85FRRJdHPd5AUwNH3Wy5v6d8xNn5SGdSJlnYZa+nDroDjQX6jBUrjWVbHZ13vIEWtKAvVj23bMS2/E9czgIBwGlgCmG1qqLsjQY73Ie4vKc6siFtGwT5aZIbrocE9PoJ52Z/HcW8U6wjLGzVOXOhraGhwuYZXkQOPLGxQW36zyIxKtkr9l5/OvTyhobS84pCozxBPgcIg7uQ+aLQrPnWsDKDvosmRvNm7 daxYtkvg6W0exX54k/+K3kcl2w6E X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(13018025)(13016025)(10201501046)(3002001); SRVR:SN1PR0201MB1934; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0201MB1934; X-Forefront-PRVS: 0920602B08 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjAyMDFNQjE5MzQ7MjM6b3M2d2NaMTdudmF6Y2VFYU0yUHQyVHR6?= =?utf-8?B?cmZsWGE2ak1rSXh2bWwvMGt1amE0d3BLOFk5d2xUMnRlZGtnRTNEWHdoZGtC?= =?utf-8?B?b0lFbTc0aDlMY2VNaEUzK3d4T3B2dEVJcTR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kdNaJj6LwNsHa9zzLr/rnWCN7mzZrNl2RFjlDzTUe4Qa0HQOIngqCk+IjJG5c4S9GlZ4+rAor/bGJWAAMNapqQUsEAtfS6xN8bxQVBib5pQYkpq3S0zSC/BvNckuRzQKclKWiVGDNkiFcPC/V4Al3E=; 20:9AWQ6/MnNatcNdGgGxUSDOsN/1qYP02jJM5zSORYljr7KMxPnyAWOjplicBRAJ9pa9ZGHLvxpHnWnMscHEqCcfNvN6B6RpLwXFlO0IRUzuEJR8ERuEJs+QV+Sre/nIc9sGz67zsClQZuI1CNFcObgCkR+/Dayy/coqVYMcURoULDhyXYHSGreVtQI7h8cozIrIWEohvO2k9PPgeb8sh4l/GWm3hEY0OFx0Gz6uRkJHTSHoXxQ2l/ZG4p/l3L7nSn SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2016 21:14:44.0420 (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: SN1PR0201MB1934 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since all srp_map_finish_fr() callers pass a non-zero value as the fourth argument (sg_nents), the sg_nents == 0 check in that function can be removed. Add a count == 0 check in the caller of that function. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Laurence Oberman Reviewed-by: Sagi Grimberg Reviewed-by: Christoph Hellwig --- drivers/infiniband/ulp/srp/ib_srp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index c0329cd..d709428c 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1315,9 +1315,6 @@ static int srp_map_finish_fr(struct srp_map_state *state, WARN_ON_ONCE(!dev->use_fast_reg); - if (sg_nents == 0) - return 0; - if (sg_nents == 1 && target->global_mr) { srp_map_desc(state, sg_dma_address(state->sg), sg_dma_len(state->sg), @@ -1439,6 +1436,9 @@ static int srp_map_sg_fr(struct srp_map_state *state, struct srp_rdma_ch *ch, state->fr.end = req->fr_list + ch->target->cmd_sg_cnt; state->sg = scat; + if (count == 0) + return 0; + while (count) { int i, n;