Commit 7a3de2b3 authored by Javier González's avatar Javier González Committed by Jens Axboe

lightnvm: free reverse device map

Free the reverse mapping table correctly on target tear down
Signed-off-by: default avatarJavier González <javier@cnexlabs.com>
Signed-off-by: default avatarMatias Bjørling <matias@cnexlabs.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent a7737f39
...@@ -411,6 +411,18 @@ static int nvm_register_map(struct nvm_dev *dev) ...@@ -411,6 +411,18 @@ static int nvm_register_map(struct nvm_dev *dev)
return -ENOMEM; return -ENOMEM;
} }
static void nvm_unregister_map(struct nvm_dev *dev)
{
struct nvm_dev_map *rmap = dev->rmap;
int i;
for (i = 0; i < dev->geo.nr_chnls; i++)
kfree(rmap->chnls[i].lun_offs);
kfree(rmap->chnls);
kfree(rmap);
}
static void nvm_map_to_dev(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p) static void nvm_map_to_dev(struct nvm_tgt_dev *tgt_dev, struct ppa_addr *p)
{ {
struct nvm_dev_map *dev_map = tgt_dev->map; struct nvm_dev_map *dev_map = tgt_dev->map;
...@@ -992,7 +1004,7 @@ void nvm_free(struct nvm_dev *dev) ...@@ -992,7 +1004,7 @@ void nvm_free(struct nvm_dev *dev)
if (dev->dma_pool) if (dev->dma_pool)
dev->ops->destroy_dma_pool(dev->dma_pool); dev->ops->destroy_dma_pool(dev->dma_pool);
kfree(dev->rmap); nvm_unregister_map(dev);
kfree(dev->lptbl); kfree(dev->lptbl);
kfree(dev->lun_map); kfree(dev->lun_map);
kfree(dev); kfree(dev);
......
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