diff options
author | Matias Bjørling <m@bjorling.me> | 2018-01-05 08:16:02 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-01-05 10:50:12 -0500 |
commit | bb27aa9ecd1f72e68b0fa2dffeb45bee3b1cb5ca (patch) | |
tree | b05c8dc0e9b37ebfee9d06e54e5e315ac3dd067c /drivers/lightnvm/core.c | |
parent | 98281a90acc04d8a10407dabd2e397e4312b80c0 (diff) |
lightnvm: remove lower page tables
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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/core.c')
-rw-r--r-- | drivers/lightnvm/core.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 390d5efd6287..52059dd0ed18 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, | |||
751 | } | 751 | } |
752 | EXPORT_SYMBOL(nvm_get_tgt_bb_tbl); | 752 | EXPORT_SYMBOL(nvm_get_tgt_bb_tbl); |
753 | 753 | ||
754 | static int nvm_init_slc_tbl(struct nvm_dev *dev, struct nvm_id_group *grp) | ||
755 | { | ||
756 | struct nvm_geo *geo = &dev->geo; | ||
757 | int i; | ||
758 | |||
759 | dev->lps_per_blk = geo->pgs_per_blk; | ||
760 | dev->lptbl = kcalloc(dev->lps_per_blk, sizeof(int), GFP_KERNEL); | ||
761 | if (!dev->lptbl) | ||
762 | return -ENOMEM; | ||
763 | |||
764 | /* Just a linear array */ | ||
765 | for (i = 0; i < dev->lps_per_blk; i++) | ||
766 | dev->lptbl[i] = i; | ||
767 | |||
768 | return 0; | ||
769 | } | ||
770 | |||
771 | static int nvm_init_mlc_tbl(struct nvm_dev *dev, struct nvm_id_group *grp) | ||
772 | { | ||
773 | int i, p; | ||
774 | struct nvm_id_lp_mlc *mlc = &grp->lptbl.mlc; | ||
775 | |||
776 | if (!mlc->num_pairs) | ||
777 | return 0; | ||
778 | |||
779 | dev->lps_per_blk = mlc->num_pairs; | ||
780 | dev->lptbl = kcalloc(dev->lps_per_blk, sizeof(int), GFP_KERNEL); | ||
781 | if (!dev->lptbl) | ||
782 | return -ENOMEM; | ||
783 | |||
784 | /* The lower page table encoding consists of a list of bytes, where each | ||
785 | * has a lower and an upper half. The first half byte maintains the | ||
786 | * increment value and every value after is an offset added to the | ||
787 | * previous incrementation value | ||
788 | */ | ||
789 | dev->lptbl[0] = mlc->pairs[0] & 0xF; | ||
790 | for (i = 1; i < dev->lps_per_blk; i++) { | ||
791 | p = mlc->pairs[i >> 1]; | ||
792 | if (i & 0x1) /* upper */ | ||
793 | dev->lptbl[i] = dev->lptbl[i - 1] + ((p & 0xF0) >> 4); | ||
794 | else /* lower */ | ||
795 | dev->lptbl[i] = dev->lptbl[i - 1] + (p & 0xF); | ||
796 | } | ||
797 | |||
798 | return 0; | ||
799 | } | ||
800 | |||
801 | static int nvm_core_init(struct nvm_dev *dev) | 754 | static int nvm_core_init(struct nvm_dev *dev) |
802 | { | 755 | { |
803 | struct nvm_id *id = &dev->identity; | 756 | struct nvm_id *id = &dev->identity; |
@@ -846,25 +799,6 @@ static int nvm_core_init(struct nvm_dev *dev) | |||
846 | if (!dev->lun_map) | 799 | if (!dev->lun_map) |
847 | return -ENOMEM; | 800 | return -ENOMEM; |
848 | 801 | ||
849 | switch (grp->fmtype) { | ||
850 | case NVM_ID_FMTYPE_SLC: | ||
851 | if (nvm_init_slc_tbl(dev, grp)) { | ||
852 | ret = -ENOMEM; | ||
853 | goto err_fmtype; | ||
854 | } | ||
855 | break; | ||
856 | case NVM_ID_FMTYPE_MLC: | ||
857 | if (nvm_init_mlc_tbl(dev, grp)) { | ||
858 | ret = -ENOMEM; | ||
859 | goto err_fmtype; | ||
860 | } | ||
861 | break; | ||
862 | default: | ||
863 | pr_err("nvm: flash type not supported\n"); | ||
864 | ret = -EINVAL; | ||
865 | goto err_fmtype; | ||
866 | } | ||
867 | |||
868 | INIT_LIST_HEAD(&dev->area_list); | 802 | INIT_LIST_HEAD(&dev->area_list); |
869 | INIT_LIST_HEAD(&dev->targets); | 803 | INIT_LIST_HEAD(&dev->targets); |
870 | mutex_init(&dev->mlock); | 804 | mutex_init(&dev->mlock); |
@@ -890,7 +824,6 @@ static void nvm_free(struct nvm_dev *dev) | |||
890 | dev->ops->destroy_dma_pool(dev->dma_pool); | 824 | dev->ops->destroy_dma_pool(dev->dma_pool); |
891 | 825 | ||
892 | nvm_unregister_map(dev); | 826 | nvm_unregister_map(dev); |
893 | kfree(dev->lptbl); | ||
894 | kfree(dev->lun_map); | 827 | kfree(dev->lun_map); |
895 | kfree(dev); | 828 | kfree(dev); |
896 | } | 829 | } |