summaryrefslogtreecommitdiff
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorMatias Bjørling <matias@cnexlabs.com>2017-01-31 15:17:10 +0300
committerJens Axboe <axboe@fb.com>2017-01-31 18:32:13 +0300
commit10995c3dc9d7f47b92ff3e74b4bd191ddb7991ff (patch)
tree8e2f54e1d53cafa64e6c52ce283ddc402a90b6d1 /drivers/lightnvm
parentade69e2432b795c76653e1dfa09c684549826a50 (diff)
downloadlinux-10995c3dc9d7f47b92ff3e74b4bd191ddb7991ff.tar.xz
lightnvm: collapse nvm_erase_ppa and nvm_erase_blk
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 <matias@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/core.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index e9a495650dd0..a4e2e3b01ae4 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;
+
+ 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));
- return nvm_erase_ppa(tgt_dev->parent, p, 1, flags);
+ 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;