Commit 81e681d3 authored by Matias Bjørling's avatar Matias Bjørling Committed by Jens Axboe

lightnvm: support multiple ppas in nvm_erase_ppa

Sometimes a user want to erase multiple PPAs at the same time. Extend
nvm_erase_ppa to take multiple ppas and number of ppas to be erased.
Signed-off-by: default avatarMatias Bjørling <m@bjorling.me>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 4b79beb4
...@@ -265,7 +265,7 @@ void nvm_free_rqd_ppalist(struct nvm_dev *dev, struct nvm_rq *rqd) ...@@ -265,7 +265,7 @@ void nvm_free_rqd_ppalist(struct nvm_dev *dev, struct nvm_rq *rqd)
} }
EXPORT_SYMBOL(nvm_free_rqd_ppalist); EXPORT_SYMBOL(nvm_free_rqd_ppalist);
int nvm_erase_ppa(struct nvm_dev *dev, struct ppa_addr ppa) int nvm_erase_ppa(struct nvm_dev *dev, struct ppa_addr *ppas, int nr_ppas)
{ {
struct nvm_rq rqd; struct nvm_rq rqd;
int ret; int ret;
...@@ -275,7 +275,7 @@ int nvm_erase_ppa(struct nvm_dev *dev, struct ppa_addr ppa) ...@@ -275,7 +275,7 @@ int nvm_erase_ppa(struct nvm_dev *dev, struct ppa_addr ppa)
memset(&rqd, 0, sizeof(struct nvm_rq)); memset(&rqd, 0, sizeof(struct nvm_rq));
ret = nvm_set_rqd_ppalist(dev, &rqd, &ppa, 1); ret = nvm_set_rqd_ppalist(dev, &rqd, ppas, nr_ppas);
if (ret) if (ret)
return ret; return ret;
......
...@@ -396,7 +396,7 @@ static int gennvm_erase_blk(struct nvm_dev *dev, struct nvm_block *blk, ...@@ -396,7 +396,7 @@ static int gennvm_erase_blk(struct nvm_dev *dev, struct nvm_block *blk,
{ {
struct ppa_addr addr = block_to_ppa(dev, blk); struct ppa_addr addr = block_to_ppa(dev, blk);
return nvm_erase_ppa(dev, addr); return nvm_erase_ppa(dev, &addr, 1);
} }
static struct nvm_lun *gennvm_get_lun(struct nvm_dev *dev, int lunid) static struct nvm_lun *gennvm_get_lun(struct nvm_dev *dev, int lunid)
......
...@@ -435,7 +435,7 @@ extern void nvm_addr_to_generic_mode(struct nvm_dev *, struct nvm_rq *); ...@@ -435,7 +435,7 @@ 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 *, extern int nvm_set_rqd_ppalist(struct nvm_dev *, struct nvm_rq *,
struct ppa_addr *, int); struct ppa_addr *, int);
extern void nvm_free_rqd_ppalist(struct nvm_dev *, struct nvm_rq *); extern void nvm_free_rqd_ppalist(struct nvm_dev *, struct nvm_rq *);
extern int nvm_erase_ppa(struct nvm_dev *, struct ppa_addr); extern int nvm_erase_ppa(struct nvm_dev *, struct ppa_addr *, int);
extern int nvm_erase_blk(struct nvm_dev *, struct nvm_block *); extern int nvm_erase_blk(struct nvm_dev *, struct nvm_block *);
extern void nvm_end_io(struct nvm_rq *, int); extern void nvm_end_io(struct nvm_rq *, int);
#else /* CONFIG_NVM */ #else /* CONFIG_NVM */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment