From patchwork Tue Jan 31 12:17:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 9547045 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 4C49260425 for ; Tue, 31 Jan 2017 12:20:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CF09280FC for ; Tue, 31 Jan 2017 12:20:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F34028372; Tue, 31 Jan 2017 12:20:00 +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 97302280FC for ; Tue, 31 Jan 2017 12:19:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbdAaMSL (ORCPT ); Tue, 31 Jan 2017 07:18:11 -0500 Received: from mail-bn3nam01on0058.outbound.protection.outlook.com ([104.47.33.58]:53760 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751982AbdAaMSH (ORCPT ); Tue, 31 Jan 2017 07:18:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1UC9uI5B34m0S0EdJ/Lx50GmZiuExewPpflWgU1LPD0=; b=JYQoEeMBXAJtqetOH1E16XOf5Y0BmYXQeuRFUgfce9um7MWSddO8Taiz6VHlFhwJEabWejny5HDMFTj/DyGPX0ykvaMuEphqsih+J0ZYx5w2/k0qtYGJExdtRyE+JPvDn1VFzc+dt50+67lnJXfGKVvy+/uW5ZirvB8+6Z/7/SE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matias@cnexlabs.com; Received: from skyninja.cnexlabs.com (193.106.164.211) by DM5PR06MB2777.namprd06.prod.outlook.com (10.175.107.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Tue, 31 Jan 2017 12:17:52 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: CC: , , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 05/12] lightnvm: make nvm_map_* return void Date: Tue, 31 Jan 2017 13:17:13 +0100 Message-ID: <20170131121720.10971-6-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170131121720.10971-1-matias@cnexlabs.com> References: <20170131121720.10971-1-matias@cnexlabs.com> MIME-Version: 1.0 X-Originating-IP: [193.106.164.211] X-ClientProxiedBy: DB6PR0601CA0024.eurprd06.prod.outlook.com (10.168.88.162) To DM5PR06MB2777.namprd06.prod.outlook.com (10.175.107.139) X-MS-Office365-Filtering-Correlation-Id: 8d9f38ca-150a-4330-dd93-08d449d32ec4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM5PR06MB2777; X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 3:2pXAwr+HlGtyLn6BdC3nAnE+xXRgp64/KuBASHVgtRNXTz4ngraIDxehRbIoF8QoMyRnZrn3wUpk+D6LIvFxjD27nGkZk3A09gmmgYWai8ovHSv3OGHo9tyesBPYcT/voVV5qVKOuWCoMEDO8kj7/UBUEHHt6n7afb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ft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6042181)(6072148); SRVR:DM5PR06MB2777; BCL:0; PCL:0; RULEID:; SRVR:DM5PR06MB2777; X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 4:d0BlXhHVssEWU1MaCJKTSpEdWBdHBnOGU0U1mQkDglckHyqCoqG+7xHUS7Jbc+03B3FOLBc6tDabqkkP9LQzzMBYGSGYqJL0yqocXitxSJvaanfZRqDq3JbUDQbWpQcNGjN7Pnvs7Nrk0lrPB8BRsFmSE6boy/KvRa2dtpwW8o/IYr7AGT3chXVo+yxS5hg8NSDuTHwG/GBHyu/QKXWF9ClVyjR0wjQ8k3AmGCcSOEw+No5hLHWBt/Dls1EKsu7CiNKyU1/LbECIlBR6IEzdu3vEut3IEzoh9vMBZPZ3BEsf1YC6AB4QwmAM0c2HLbKGXTxuZwCbcFhcDhX6WkO2wxl742K3aGtQxNufsOzAFNU/M2vd0wIaVTz7U3wXECCiwJJR/xo/69cMYztZq0V4A7sHn/ccZVb7smHXQ1mXbocfz8O8vUWx3fMLfCUA9U4s7iTFz2t893dYmTkp6xvBqDB3XKZgyrthZ/Q06CY/ONM3NuUEEQc9HpJoXuWEsPzNi84YwG0MP4h7CoLcbbvz1z1kfs9MaJPmO93RizE2MoGLMFNLjEbS1cOdyFBDqZ/1tZM/PPut4DPY1ZYlV9kaFlEVQqN7pQrkpPqPaP8POqmYliPyKVm22qM7FHA0Ydb0 X-Forefront-PRVS: 0204F0BDE2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(42186005)(66066001)(50466002)(6486002)(47776003)(38730400001)(105586002)(54906002)(25786008)(106356001)(2351001)(36756003)(68736007)(4001430100002)(53416004)(50986999)(107886002)(7736002)(2906002)(305945005)(4326007)(110136003)(23676002)(2870700001)(189998001)(5660300001)(92566002)(86362001)(1076002)(6116002)(3846002)(33646002)(6916009)(97736004)(2950100002)(5820100001)(6666003)(76176999)(101416001)(53936002)(81166006)(81156014)(8676002)(50226002)(69596002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR06MB2777; H:skyninja.cnexlabs.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cnexlabs.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjA2TUIyNzc3OzIzOkZ0N1JQaGp0SDM1RGd5TEVRajVOUTJCcGNN?= =?utf-8?B?cmJkcUtwZVpoN3IrcHRNU1AyTmphSkcwK1pLZDNxRmpqV2grOGhlMi9Wem9P?= =?utf-8?B?QUhORG5lcXJ4UjA4ODBHU1hlc0dvT1ZSQkM5Rlo0b3VEcy9BaWNQZFlyLzBu?= =?utf-8?B?R3Q4U3hUcGlvQUd6aEk0elBjL0gxT2FGakhSZVNBSit1T25QTFJkM01aTVJ1?= =?utf-8?B?TmtmN1VMdTMxVkZucmYwV3RRUUFIdkFCQjVKWlFiVitCUmFYRWlncnNhbG0v?= =?utf-8?B?RDQ3Sis1bUxtYVhLdVh2TWFtN1loaC9KVzFXRGxkdWZvTkVkbG9NMHM5Q0pU?= =?utf-8?B?dVgycmxNcmhhaWV5SWRVSWlqcHZHWnNYSXR6SGwrbmZhT0Y1cU8vTDJmUk5t?= =?utf-8?B?UWVuSEpNcGhjajZxSTN2V2NxMTc5RzdKT3FkRjRFN2plTlB1WkxRb1Z1ckVX?= =?utf-8?B?SHBBQ2JhdVQ0QllZSmtQa3JZVzZCVlZITVFtTTVBMmpyM2c0NTJFVE1Fc0tz?= =?utf-8?B?RDZ2Q2E0QWVGTkFTOEFMYlB5NXRQcUdBUHFWeDc1SU94VnRpMWNMWlZ4N0Q3?= =?utf-8?B?TUZw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ZY?= =?utf-8?B?UWwxVXZuWmNDZHNVZUtvSTRJamg2cWdMUjVDdjQrR0JWTDJ1SEkxdzd1czJB?= =?utf-8?B?bVlveTdhaUdlaFdwRG5ZQ3NCZXZvS28raEpmQ2dicWxRSmYzTGJKZzgvNy91?= =?utf-8?Q?O8AzoLbVScBpez/uUgnx?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 6:wQUvWpu+o+b17U+Zpa8yqTiUkluQEJO+F0SMbd0g3f0yisEp30KPjj36YRZWsB7S6kNReM/FNagohId+ZFc52vZr8m3DzSZ+QM3sbsS1jjRfwYIUUtGcq0L9QAyUg8YoBP6jT7Usyat4fifiMAx5eUfhG0PtupzhUsHeFxlIqPTrin3K0vMHbEoAqtX+LKAL5SzyOCK8aPS4uo5gICN0SFWhQE/EqHNL20ID1PmIKcqUvuT7S04v4RCMd8xdv2EtrX/pQa6DD/gBcbLN/a8A0Y4iplzmDJxFdIel5qwXBWUU+kbxPluXKqs+5+uEoKYLBXura5pl5Z1UkDLvQaHuP8DPTUNK83JXym55UI5QLRJ7eVjVhF9hCQN+vKlOAZfjpwi/r3Agwk0XSeE191Wnq8oiXV962K05j2fE5QX1uaM=; 5:jKlsyD7z7yqUxMcGFDGKjoDxOtr7Y262IwEXUyNt+jyhTxgQGq6GNvXmOitF/7dZv42JLa6/t+7wk7gZceRapcwCyBjyLcap46IDtSpdcRUV0eewCdha8UeAuAPTw7LTjE2uPbsrHOPl4u2IzO6cqg==; 24:vQdr8D2x4n/JB4aefLoMnAp4cn3yLbnvVPaKzZNrz7bzUqIMrb3JaiV2T2138KxTHMsI0ZHgQmfGwRhFeDzOZywDu/IbAqsxOlLqfCd70dI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 7:w4d6NCzIXhuNqFXIHROh+4r6ooKXzPpw61zwOK4Pk1VR0WV0BnzlCfauK2RqfUZClM6cCOf3OBkWown8QYNBHVyGpfzA8PiBpIkCqHkbm74jBHBtw+R0HW/eV2/GZUdObw7n1Sw6gcWPASA8lbzBd2M7DkCRfg6MDon1k+t7m164zo+aMN1Fr/i5cLtloy4D/hmicmtwBWos3tqn1EL7P4/bevx50TO0PPcDMiDtlOoDfK1KKIZ4J8147F5OWSrHBnGFD+i+kC4b1LHex3pgFgZB6WAAlPWrxCxmEgcR6Fwlc2tUdVg9HHAUa00XzpwgT5TheNKccB8l0aHqCTdyrriptCMTRz0fwRvMCEWSOocAoTDGU8sFDPtZiYovxUKBuFCdmn/dqY++hs20dAAtPZcdgyL46fSDrqGJz1cgrENXYKRyScUgPLATYo8krD9RSLZQxFGYFgIlkgKHgFkfj7egs7S8m8m/6J5YmXfxG0dh5b6XSQR+7xp8AlsdBar2/M3uxE6GKy8cn1E2ZZfxb8cJ3j3ClHyznvUgI/ueKnhVf+Y47bn48WmRE/1uQGQM X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2017 12:17:52.9366 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR06MB2777 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The only check there was done was a debugging check. Remove it and replace the return value with void to reduce error checking. Signed-off-by: Matias Bjørling --- drivers/lightnvm/core.c | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 18d4873..a1a7a5a 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -407,31 +407,17 @@ static int nvm_register_map(struct nvm_dev *dev) return -ENOMEM; } -static int nvm_map_to_dev(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p) +static void nvm_map_to_dev(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p) { struct nvm_dev_map *dev_map = tgt_dev->map; struct nvm_ch_map *ch_map = &dev_map->chnls[p->g.ch]; int lun_off = ch_map->lun_offs[p->g.lun]; - struct nvm_dev *dev = tgt_dev->parent; - struct nvm_dev_map *dev_rmap = dev->rmap; - struct nvm_ch_map *ch_rmap; - int lun_roff; p->g.ch += ch_map->ch_off; p->g.lun += lun_off; - - ch_rmap = &dev_rmap->chnls[p->g.ch]; - lun_roff = ch_rmap->lun_offs[p->g.lun]; - - if (unlikely(ch_rmap->ch_off < 0 || lun_roff < 0)) { - pr_err("nvm: corrupted device partition table\n"); - return -EINVAL; - } - - return 0; } -static int nvm_map_to_tgt(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p) +static void nvm_map_to_tgt(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p) { struct nvm_dev *dev = tgt_dev->parent; struct nvm_dev_map *dev_rmap = dev->rmap; @@ -440,34 +426,27 @@ static int nvm_map_to_tgt(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p) p->g.ch -= ch_rmap->ch_off; p->g.lun -= lun_roff; - - return 0; } -static int nvm_trans_rq(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd, +static void nvm_trans_rq(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd, int flag) { int i; - int ret; if (rqd->nr_ppas == 1) { if (flag == TRANS_TGT_TO_DEV) - return nvm_map_to_dev(tgt_dev, &rqd->ppa_addr); + nvm_map_to_dev(tgt_dev, &rqd->ppa_addr); else - return nvm_map_to_tgt(tgt_dev, &rqd->ppa_addr); + nvm_map_to_tgt(tgt_dev, &rqd->ppa_addr); + return; } for (i = 0; i < rqd->nr_ppas; i++) { if (flag == TRANS_TGT_TO_DEV) - ret = nvm_map_to_dev(tgt_dev, &rqd->ppa_list[i]); + nvm_map_to_dev(tgt_dev, &rqd->ppa_list[i]); else - ret = nvm_map_to_tgt(tgt_dev, &rqd->ppa_list[i]); - - if (ret) - break; + nvm_map_to_tgt(tgt_dev, &rqd->ppa_list[i]); } - - return ret; } static struct ppa_addr nvm_trans_ppa(struct nvm_tgt_dev *tgt_dev, @@ -665,9 +644,7 @@ int nvm_erase_blk(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *ppas, int flags) if (!dev->ops->erase_block) return 0; - ret = nvm_map_to_dev(tgt_dev, ppas); - if (ret) - return ret; + nvm_map_to_dev(tgt_dev, ppas); memset(&rqd, 0, sizeof(struct nvm_rq));