From patchwork Mon Jan 23 11:59: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: 9532351 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 121C160434 for ; Mon, 23 Jan 2017 12:01:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E729628305 for ; Mon, 23 Jan 2017 12:01:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC0412833A; Mon, 23 Jan 2017 12:01:33 +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 5C97528305 for ; Mon, 23 Jan 2017 12:01:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751230AbdAWMA3 (ORCPT ); Mon, 23 Jan 2017 07:00:29 -0500 Received: from mail-wj0-f194.google.com ([209.85.210.194]:36028 "EHLO mail-wj0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbdAWMAU (ORCPT ); Mon, 23 Jan 2017 07:00:20 -0500 Received: by mail-wj0-f194.google.com with SMTP id kq3so1730461wjc.3 for ; Mon, 23 Jan 2017 03:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=thXQxkCFXMrMnxCCNoTTUKehxTMtWebxgJtCuGeY1Bw=; b=mwqccCOWVvhw/gnGbib9qhlJMrlYAt2Fj1jx1T6GTb95lYM0zdtvN01RMsn9bPqNhg PgEwF7TLyC+v+eflJDZi5+LaBEmt2BRtrSUMvU691PvrT7WVim0+yMJA2Q9Yw6NLzVp8 0DLgtSZ4tbPXDPGV2n1xqWvvtf38LM2sG+0MQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=thXQxkCFXMrMnxCCNoTTUKehxTMtWebxgJtCuGeY1Bw=; b=o+1GptMesYiaIPJ8ExQI2mzQwU5z4mnDzee5I26bG3OPnXyuSiA/Guiu8tUgf5u75z hSqPEwLRHMO4A84pVwvqzTHhu0XeJbF+12Efm/HS+ysoUA8HiMfrtWSTtORN5IjmueQb yiUKppaE2v7Alf5oh8yXzustcmJmNCvp0o+x624hETqE6EM4JLiplB6WTW/Htk5ATa5w ww3egAdYLabqz7whRgTCUZ/fH/qDlDVKi8MajgRZUiY1ZeKM7zOqFMEdE066iMT+oq8J mzwei1gaDODkoim2QTjHx7dKAQeOiwKYZ09omIzmHqO7y4FFeBH4yShNib5BpA9+CCCs 5vSA== X-Gm-Message-State: AIkVDXKXiijNALe5ojoqsv2RP/Oj/u3Jwuw0ZNyhFtGyB9A1lxwFkEJ5xqc/i02PSDEVeA== X-Received: by 10.223.175.36 with SMTP id z33mr23113024wrc.25.1485172784365; Mon, 23 Jan 2017 03:59:44 -0800 (PST) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id x135sm20715381wme.23.2017.01.23.03.59.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 03:59:43 -0800 (PST) From: "=?UTF-8?q?Matias=20Bj=C3=B8rling?=" X-Google-Original-From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 2/8] lightnvm: collapse nvm_erase_ppa and nvm_erase_blk Date: Mon, 23 Jan 2017 12:59:13 +0100 Message-Id: <20170123115919.14339-3-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170123115919.14339-1-matias@cnexlabs.com> References: <20170123115919.14339-1-matias@cnexlabs.com> MIME-Version: 1.0 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 *);