linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matias Bjørling" <m@bjorling.me>
To: axboe@fb.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Matias Bjørling" <m@bjorling.me>
Subject: [GIT PULL 06/25] lightnvm: remove lower page tables
Date: Fri,  5 Jan 2018 14:16:02 +0100	[thread overview]
Message-ID: <20180105131621.20808-7-m@bjorling.me> (raw)
In-Reply-To: <20180105131621.20808-1-m@bjorling.me>

The lower page table is unused. All page tables reported by 1.2
devices are all reporting a sequential 1:1 page mapping. This is
also not used going forward with the 2.0 revision.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Reviewed-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/lightnvm/core.c      | 67 --------------------------------------------
 drivers/nvme/host/lightnvm.c | 14 ---------
 include/linux/lightnvm.h     |  6 ----
 3 files changed, 87 deletions(-)

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 390d5ef..52059dd 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -751,53 +751,6 @@ int nvm_get_tgt_bb_tbl(struct nvm_tgt_dev *tgt_dev, struct ppa_addr ppa,
 }
 EXPORT_SYMBOL(nvm_get_tgt_bb_tbl);
 
-static int nvm_init_slc_tbl(struct nvm_dev *dev, struct nvm_id_group *grp)
-{
-	struct nvm_geo *geo = &dev->geo;
-	int i;
-
-	dev->lps_per_blk = geo->pgs_per_blk;
-	dev->lptbl = kcalloc(dev->lps_per_blk, sizeof(int), GFP_KERNEL);
-	if (!dev->lptbl)
-		return -ENOMEM;
-
-	/* Just a linear array */
-	for (i = 0; i < dev->lps_per_blk; i++)
-		dev->lptbl[i] = i;
-
-	return 0;
-}
-
-static int nvm_init_mlc_tbl(struct nvm_dev *dev, struct nvm_id_group *grp)
-{
-	int i, p;
-	struct nvm_id_lp_mlc *mlc = &grp->lptbl.mlc;
-
-	if (!mlc->num_pairs)
-		return 0;
-
-	dev->lps_per_blk = mlc->num_pairs;
-	dev->lptbl = kcalloc(dev->lps_per_blk, sizeof(int), GFP_KERNEL);
-	if (!dev->lptbl)
-		return -ENOMEM;
-
-	/* The lower page table encoding consists of a list of bytes, where each
-	 * has a lower and an upper half. The first half byte maintains the
-	 * increment value and every value after is an offset added to the
-	 * previous incrementation value
-	 */
-	dev->lptbl[0] = mlc->pairs[0] & 0xF;
-	for (i = 1; i < dev->lps_per_blk; i++) {
-		p = mlc->pairs[i >> 1];
-		if (i & 0x1) /* upper */
-			dev->lptbl[i] = dev->lptbl[i - 1] + ((p & 0xF0) >> 4);
-		else /* lower */
-			dev->lptbl[i] = dev->lptbl[i - 1] + (p & 0xF);
-	}
-
-	return 0;
-}
-
 static int nvm_core_init(struct nvm_dev *dev)
 {
 	struct nvm_id *id = &dev->identity;
@@ -846,25 +799,6 @@ static int nvm_core_init(struct nvm_dev *dev)
 	if (!dev->lun_map)
 		return -ENOMEM;
 
-	switch (grp->fmtype) {
-	case NVM_ID_FMTYPE_SLC:
-		if (nvm_init_slc_tbl(dev, grp)) {
-			ret = -ENOMEM;
-			goto err_fmtype;
-		}
-		break;
-	case NVM_ID_FMTYPE_MLC:
-		if (nvm_init_mlc_tbl(dev, grp)) {
-			ret = -ENOMEM;
-			goto err_fmtype;
-		}
-		break;
-	default:
-		pr_err("nvm: flash type not supported\n");
-		ret = -EINVAL;
-		goto err_fmtype;
-	}
-
 	INIT_LIST_HEAD(&dev->area_list);
 	INIT_LIST_HEAD(&dev->targets);
 	mutex_init(&dev->mlock);
@@ -890,7 +824,6 @@ static void nvm_free(struct nvm_dev *dev)
 		dev->ops->destroy_dma_pool(dev->dma_pool);
 
 	nvm_unregister_map(dev);
-	kfree(dev->lptbl);
 	kfree(dev->lun_map);
 	kfree(dev);
 }
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 26f7ecc..15bf243 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -246,20 +246,6 @@ static int init_grps(struct nvm_id *nvm_id, struct nvme_nvm_id *nvme_nvm_id)
 
 	dst->cpar = le16_to_cpu(src->cpar);
 
-	if (dst->fmtype == NVM_ID_FMTYPE_MLC) {
-		memcpy(dst->lptbl.id, src->lptbl.id, 8);
-		dst->lptbl.mlc.num_pairs =
-				le16_to_cpu(src->lptbl.mlc.num_pairs);
-
-		if (dst->lptbl.mlc.num_pairs > NVME_NVM_LP_MLC_PAIRS) {
-			pr_err("nvm: number of MLC pairs not supported\n");
-			return -EINVAL;
-		}
-
-		memcpy(dst->lptbl.mlc.pairs, src->lptbl.mlc.pairs,
-					dst->lptbl.mlc.num_pairs);
-	}
-
 	return 0;
 }
 
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 07cdb05..a5d8e0c 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -174,8 +174,6 @@ struct nvm_id_group {
 	u32	mpos;
 	u32	mccap;
 	u16	cpar;
-
-	struct nvm_id_lp_tbl lptbl;
 };
 
 struct nvm_addr_format {
@@ -313,10 +311,6 @@ struct nvm_dev {
 	/* Device information */
 	struct nvm_geo geo;
 
-	  /* lower page table */
-	int lps_per_blk;
-	int *lptbl;
-
 	unsigned long total_secs;
 
 	unsigned long *lun_map;
-- 
2.9.3

  parent reply	other threads:[~2018-01-05 13:22 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-05 13:15 [GIT PULL 00/25] LightNVM updates for 4.16 Matias Bjørling
2018-01-05 13:15 ` [GIT PULL 01/25] null_blk: remove lightnvm support Matias Bjørling
2018-01-05 13:15 ` [GIT PULL 02/25] lightnvm: remove rrpc Matias Bjørling
2018-01-05 13:15 ` [GIT PULL 03/25] lightnvm: use internal pblk methods Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 04/25] lightnvm: remove hybrid ocssd 1.2 support Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 05/25] lightnvm: remove unnecessary field from nvm_rq Matias Bjørling
2018-01-05 13:16 ` Matias Bjørling [this message]
2018-01-05 13:16 ` [GIT PULL 07/25] lightnvm: make geometry structures 2.0 ready Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 08/25] lightnvm: refactor target type lookup Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 09/25] lightnvm: guarantee target unique name across devs Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 10/25] lightnvm: pblk: compress and reorder helper functions Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 11/25] lightnvm: pblk: remove pblk_for_each_lun helper Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 12/25] lightnvm: pblk: refactor emeta consistency check Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 13/25] lightnvm: pblk: rename sync_point to flush_point Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 14/25] lightnvm: pblk: clear flush point on completed writes Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 15/25] lightnvm: pblk: prevent premature sync point resets Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 16/25] lightnvm: pblk: remove pblk_gc_stop Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 17/25] lightnvm: pblk: use exact free block counter in RL Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 18/25] lightnvm: set target over-provision on create ioctl Matias Bjørling
2018-01-05 19:33   ` Randy Dunlap
2018-01-05 19:52     ` Javier Gonzalez
2018-01-05 19:53       ` Matias Bjørling
2018-01-05 19:56         ` Javier Gonzalez
2018-01-05 20:17           ` Randy Dunlap
2018-01-05 13:16 ` [GIT PULL 19/25] lightnvm: pblk: ignore high ecc errors on recovery Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 20/25] lightnvm: pblk: do not log recovery read errors Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 21/25] lightnvm: pblk: ensure kthread alloc. before kicking it Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 22/25] lightnvm: pblk: free write buffer on init failure Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 23/25] lightnvm: pblk: print instance name on instance info Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 24/25] lightnvm: pblk: add iostat support Matias Bjørling
2018-01-05 15:42   ` Jens Axboe
2018-01-05 18:33     ` Matias Bjørling
2018-01-08 11:54       ` Christoph Hellwig
2018-01-08 12:53         ` Javier González
2018-01-08 13:31           ` Matias Bjørling
2018-01-05 13:16 ` [GIT PULL 25/25] lightnvm: pblk: refactor pblk_ppa_comp function Matias Bjørling
2018-01-05 15:50 ` [GIT PULL 00/25] LightNVM updates for 4.16 Jens Axboe
2018-01-05 18:34   ` Matias Bjørling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180105131621.20808-7-m@bjorling.me \
    --to=m@bjorling.me \
    --cc=axboe@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).