Linux block layer
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@lightnvm.io>
To: "Javier González" <jg@lightnvm.io>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Javier González" <javier@cnexlabs.com>
Subject: Re: [PATCH 3/3] lightnvm: free reverse device map
Date: Fri, 24 Feb 2017 18:08:19 +0100	[thread overview]
Message-ID: <c30a575d-e8e3-6637-cff9-96f9be0de2e1@lightnvm.io> (raw)
In-Reply-To: <1487952846-29476-3-git-send-email-javier@cnexlabs.com>

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@cnexlabs.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.

  reply	other threads:[~2017-02-24 17:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24 16:14 [PATCH 1/3] lightnvm: submit erases using the I/O path Javier González
2017-02-24 16:14 ` [PATCH 2/3] lightnvm: rename scrambler controller hint Javier González
2017-02-24 17:08   ` Matias Bjørling
2017-02-24 16:14 ` [PATCH 3/3] lightnvm: free reverse device map Javier González
2017-02-24 17:08   ` Matias Bjørling [this message]
2017-02-24 17:08 ` [PATCH 1/3] lightnvm: submit erases using the I/O path Matias Bjørling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c30a575d-e8e3-6637-cff9-96f9be0de2e1@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=javier@cnexlabs.com \
    --cc=jg@lightnvm.io \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox