[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c30a575d-e8e3-6637-cff9-96f9be0de2e1@lightnvm.io>
Date: Fri, 24 Feb 2017 18:08:19 +0100
From: Matias Bjørling <mb@...htnvm.io>
To: Javier González <jg@...htnvm.io>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Javier González <javier@...xlabs.com>
Subject: Re: [PATCH 3/3] lightnvm: free reverse device map
On 02/24/2017 05:14 PM, Javier González wrote:
> Free the reverse mapping table correctly on target tear down
>
> Signed-off-by: Javier González <javier@...xlabs.com>
> ---
> drivers/lightnvm/core.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index ca48792..f1cb485 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -413,6 +413,18 @@ static int nvm_register_map(struct nvm_dev *dev)
> 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)
> {
> struct nvm_dev_map *dev_map = tgt_dev->map;
> @@ -994,7 +1006,7 @@ void nvm_free(struct nvm_dev *dev)
> if (dev->dma_pool)
> dev->ops->destroy_dma_pool(dev->dma_pool);
>
> - kfree(dev->rmap);
> + nvm_unregister_map(dev);
> kfree(dev->lptbl);
> kfree(dev->lun_map);
> kfree(dev);
>
Thanks, applied for 4.12.
Powered by blists - more mailing lists