From: "Matias Bjørling" <mb@lightnvm.io>
To: Wenwei Tao <ww.tao0320@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 2/3] lightnvm: store rrpc soffset in device sector size instead of 512
Date: Sat, 16 Apr 2016 16:02:42 +0200 [thread overview]
Message-ID: <57124602.9000307@lightnvm.io> (raw)
In-Reply-To: <1460536072-1728-2-git-send-email-ww.tao0320@gmail.com>
On 04/13/2016 10:27 AM, Wenwei Tao wrote:
> Since we mainly use soffset in device sector size, we store
> that value in rrpc->soffset to reduce doing "(ilog2(dev->sec_size) - 9)".
>
> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
> drivers/lightnvm/rrpc.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
> index c0e303c..3143b98 100644
> --- a/drivers/lightnvm/rrpc.c
> +++ b/drivers/lightnvm/rrpc.c
> @@ -1039,11 +1039,8 @@ static int rrpc_map_init(struct rrpc *rrpc)
> {
> struct nvm_dev *dev = rrpc->dev;
> sector_t i;
> - u64 slba;
> int ret;
>
> - slba = rrpc->soffset >> (ilog2(dev->sec_size) - 9);
> -
> rrpc->trans_map = vzalloc(sizeof(struct rrpc_addr) * rrpc->nr_sects);
> if (!rrpc->trans_map)
> return -ENOMEM;
> @@ -1065,8 +1062,8 @@ static int rrpc_map_init(struct rrpc *rrpc)
> return 0;
>
> /* Bring up the mapping table from device */
> - ret = dev->ops->get_l2p_tbl(dev, slba, rrpc->nr_sects, rrpc_l2p_update,
> - rrpc);
> + ret = dev->ops->get_l2p_tbl(dev, rrpc->soffset, rrpc->nr_sects,
> + rrpc_l2p_update, rrpc);
> if (ret) {
> pr_err("nvm: rrpc: could not read L2P table.\n");
> return -EINVAL;
> @@ -1220,18 +1217,24 @@ static int rrpc_area_init(struct rrpc *rrpc, sector_t *begin)
> struct nvm_dev *dev = rrpc->dev;
> struct nvmm_type *mt = dev->mt;
> sector_t size = rrpc->nr_sects * dev->sec_size;
> + int ret;
>
> size >>= 9;
>
> - return mt->get_area(dev, begin, size);
> + ret = mt->get_area(dev, begin, size);
> + if (!ret)
> + *begin >>= (ilog2(dev->sec_size) - 9);
> +
> + return ret;
> }
>
> static void rrpc_area_free(struct rrpc *rrpc)
> {
> struct nvm_dev *dev = rrpc->dev;
> struct nvmm_type *mt = dev->mt;
> + sector_t begin = rrpc->soffset << (ilog2(dev->sec_size) - 9);
>
> - mt->put_area(dev, rrpc->soffset);
> + mt->put_area(dev, begin);
> }
>
> static void rrpc_free(struct rrpc *rrpc)
>
Thanks. Applied for 4.7.
next prev parent reply other threads:[~2016-04-16 14:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-13 8:27 [PATCH 1/3] lightnvm: calculate rrpc total blocks and sectors up front Wenwei Tao
2016-04-13 8:27 ` [PATCH 2/3] lightnvm: store rrpc soffset in device sector size instead of 512 Wenwei Tao
2016-04-16 14:02 ` Matias Bjørling [this message]
2016-04-13 8:27 ` [PATCH 3/3] lightnvm: fix address issues related to multi target Wenwei Tao
2016-04-16 13:28 ` [PATCH 1/3] lightnvm: calculate rrpc total blocks and sectors up front 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=57124602.9000307@lightnvm.io \
--to=mb@lightnvm.io \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ww.tao0320@gmail.com \
/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
Powered by JetHome