From patchwork Tue Jan 31 12:17:10 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: 9547013 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 30B68604DE for ; Tue, 31 Jan 2017 12:18:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2317728372 for ; Tue, 31 Jan 2017 12:18:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1839828384; Tue, 31 Jan 2017 12:18:10 +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 3074028372 for ; Tue, 31 Jan 2017 12:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751821AbdAaMSH (ORCPT ); Tue, 31 Jan 2017 07:18:07 -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 S1751656AbdAaMSA (ORCPT ); Tue, 31 Jan 2017 07:18:00 -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=6T4GqWDFhtxdMi3/n+lq5CRMLFbQPhXuUufmdyDuawo=; b=LAomPNR+vwXh/j5LVNxq9z6M64XOOBHWWb2le2OT1lEUUyOeiJXrrvNOTWBell9fm7ieqs9inDe0dbjQhxLghp/Js1wlAojn0YS3tqPnapCK5JSGP7lbblNJlhLydDXGknvtAdzM1d7UJQtyL+rHo8yEtYv45CzDAyXWdhe75ZA= 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:48 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: CC: , , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 02/12] lightnvm: collapse nvm_erase_ppa and nvm_erase_blk Date: Tue, 31 Jan 2017 13:17:10 +0100 Message-ID: <20170131121720.10971-3-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: c4f0ff44-2f76-4f03-329e-08d449d32c3d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM5PR06MB2777; X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 3:Fgi63x/1+0QuLiCJqHK3J+0o+iu6Xj9RWxllbJI/bYsVK7sc2/zduo9dIDAuRr2W/Wi5FZrK0p57nwxu0HJN2PP4ZwyR3ZXV2/Fe7VQ4W7P8sZJVAPDLwdYAVrGuGqvj4P+q5XrBmVFCIe9H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UxRr4usq2s6jNqqf2ss8he+hzUhi2pFprNhl1YJ6VcBVSxUOBl3Sd2eQUh9mkYU4YIMLabrgWs4TBZk8iOWwNciBtH2ZxbJa35AcSfaCCLm; 20:CWGhIMTIwjkpW33vdQKWsGttLXInE1j5GLhfUVJBMV23vx0SDwHHHnNUUlnxCPOQstDufEqvBnBWrPKNhOePWsRbzQcnR7Y3u3/4ZNLCnBypOKHmUaZMpb5VJNUqke6zIdHlGTXnokuKy7LUyIA9hEtge++ty716ckecdLOtjlQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; 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:WjvQ9vBr7Ptib1BeOf7Sc86h+YHOOI7qqSOLanaechMz7HSvqB5VIzSGPEA9U0Ot0BKiDmKohZDXiOtRFU5U/zjj6Dr0/GgEnHiNA4sls9gNQA/Xn79x4P8Hv7KCVk5O0NSPYdh9A4z8NWdWuwMzzYba4YIwvwJqZnkr5r1klmGNjEnK1eNy5ptdkXwkmluacs5dP6VlxwyFwCH1SsDhqBWAw40QLuVGDvJ+dMg2fm/5h4K2+U/wKtOmWcmD7487GHQ4O850aKHPLKTSuHFD/SXKYz7ianZJlBNoCapGUgkgHoiN/GfiTwf4oBEibmNjyxo/YvUPXWTufwzGWG2pnVQ/3j9Z1Vi8uPWIA8GKDH1FIr0Pv5dSXwj5ZvqP27Qcan2Lh/RDv8JBTf5RIoVD8sFItW4Mf8vnPTtaMoIxV9P//z90k67TPhgA2WP3f5qBLnHPV03QmVKr4LAImQ77YswL4XbFp1SSu6vBt2ygkFg2WFZub2Pbw+eOLEIELC3E/jGZVp0HemhfQKWdq5iksakb8xNJyWaK0TUu7/82Gn8MmleCYnsQN4Aoc/wuoxhBD42LEw6iZEYJ7a39kCW6bw== 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?MTtETTVQUjA2TUIyNzc3OzIzOkxaeU9CNEtqVVFyYmo3VFdISCtiMC8zREdN?= =?utf-8?B?NkZSc3NBKzYzTVBJcTlyYlU1QUFhSnRsRE00TTJ3V25uTytyNktNdzFvYzQ5?= =?utf-8?B?b1l4U3FyUG5uVnpBR3lZZktSL2I3UVl2dTQzMDQxdlZrYzNzZko2Q3VYZ1Ar?= =?utf-8?B?Ti9lbkpOZVVxcTArT2IyMTZRWDhjS2twZ2FlUEpJbzJsYmkyTzd4V3pFbnlX?= =?utf-8?B?OUw2Y0VsdUdUanY0ZUVHWGx4OEc2U0RYRDAvZkZ5cThYVkhGRDkwR1MyTHg4?= =?utf-8?B?WTVBMC9WVmRpNHZPMUl3UEkrYVRVdWpETFVLRndiNy9SMlp3amJpYnVzZTBX?= =?utf-8?B?a1dZV1lRbE9LTjFuQ2RBK2piK0JOZUFNZGdNOHFDak9EVEZlejBoNFVDM1pr?= =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5hO2ZRzMQSZ1lZoVTvSWVW+X4+3N+SceU5BJM4GTLfV/w7USJ+FSLYRFtZFDUi+OXqU8S/x62zcA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 7:+tpkIp7l8kWdmw8LJZ9bQrNa9SGa9gNaYIxWYK8E/laGJatI6fJu7pk1TONNL7JVnX79Eeurq9ZYj1AimcXJUaG+OeC8bCsAlvv4usY2LHVN43wp/6PsVhwu4GmfEMi1lQJz8yIWqdYHlnmrLaSrJ/rpJ7L+UCJiHqh+DHr309gfk0L+uV6jxnOdYoa5njGLlBW8v6xlFRjMaX2WEZGd0ki1exNx3UOd+1znBenLi2V+aS7Qg7h+L1MSAlxNQ8Cxt0IsntkhyRbuucLYntg7gD3WATNJ37G3PNmpNRjpIqLQFjTQbhloCI8VtSviv748GrUCzkob21y846upnYfCCu49PxiEhFfqQ/tD5JCjP7xjPVMtH5iLHAc91R5aIUEyVOsmnHZtEL/oYhC95h6bD2mfCoVk0pgh6TsoRXrv8bc97nOGGnGHUAlu2+9iEThvOM1G1b3TYfd1Lxfws2ggMm6W1T1yte6g6HNrGGFRlxAcq3UXRc5YmEhgXl1oa4iUSqJB4mm45/QG8JNPyZ1di1OfT0goO/raaheupAnfkelQYEag2CqO5iUYGBtiTB00 X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2017 12:17:48.6920 (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 After gennvm and core have been merged, there are no more callers to nvm_erase_ppa. Therefore collapse the device specific and target specific erase functions. Signed-off-by: Matias Bjørling --- drivers/lightnvm/core.c | 57 ++++++++++++++++++++++-------------------------- include/linux/lightnvm.h | 1 - 2 files changed, 26 insertions(+), 32 deletions(-) diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index e9a4956..a4e2e3b 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -683,12 +683,34 @@ int nvm_submit_io(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd) } EXPORT_SYMBOL(nvm_submit_io); -int nvm_erase_blk(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p, int flags) +int nvm_erase_blk(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *ppas, int flags) { - /* Convert address space */ - nvm_map_to_dev(tgt_dev, p); + struct nvm_dev *dev = tgt_dev->parent; + struct nvm_rq rqd; + int ret; - return nvm_erase_ppa(tgt_dev->parent, p, 1, flags); + if (!dev->ops->erase_block) + return 0; + + ret = nvm_map_to_dev(tgt_dev, ppas); + if (ret) + return ret; + + memset(&rqd, 0, sizeof(struct nvm_rq)); + + ret = nvm_set_rqd_ppalist(dev, &rqd, ppas, 1, 1); + if (ret) + return ret; + + nvm_generic_to_addr_mode(dev, &rqd); + + rqd.flags = flags; + + ret = dev->ops->erase_block(dev, &rqd); + + nvm_free_rqd_ppalist(dev, &rqd); + + return ret; } EXPORT_SYMBOL(nvm_erase_blk); @@ -847,33 +869,6 @@ void nvm_free_rqd_ppalist(struct nvm_dev *dev, struct nvm_rq *rqd) } EXPORT_SYMBOL(nvm_free_rqd_ppalist); -int nvm_erase_ppa(struct nvm_dev *dev, struct ppa_addr *ppas, int nr_ppas, - int flags) -{ - struct nvm_rq rqd; - int ret; - - if (!dev->ops->erase_block) - return 0; - - memset(&rqd, 0, sizeof(struct nvm_rq)); - - ret = nvm_set_rqd_ppalist(dev, &rqd, ppas, nr_ppas, 1); - if (ret) - return ret; - - nvm_generic_to_addr_mode(dev, &rqd); - - rqd.flags = flags; - - ret = dev->ops->erase_block(dev, &rqd); - - nvm_free_rqd_ppalist(dev, &rqd); - - return ret; -} -EXPORT_SYMBOL(nvm_erase_ppa); - void nvm_end_io(struct nvm_rq *rqd, int error) { struct nvm_tgt_dev *tgt_dev = rqd->dev; diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 84309fe..f2007b2 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -483,7 +483,6 @@ extern void nvm_addr_to_generic_mode(struct nvm_dev *, struct nvm_rq *); extern int nvm_set_rqd_ppalist(struct nvm_dev *, struct nvm_rq *, const struct ppa_addr *, int, int); extern void nvm_free_rqd_ppalist(struct nvm_dev *, struct nvm_rq *); -extern int nvm_erase_ppa(struct nvm_dev *, struct ppa_addr *, int, int); extern int nvm_erase_blk(struct nvm_tgt_dev *, struct ppa_addr *, int); extern int nvm_get_l2p_tbl(struct nvm_tgt_dev *, u64, u32, nvm_l2p_update_fn *, void *);