From: Minwoo Im <minwoo.im.dev@gmail.com>
To: Klaus Jensen <its@irrelevant.dk>
Cc: Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Klaus Jensen <k.jensen@samsung.com>,
Gollu Appalanaidu <anaidu.gollu@samsung.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH v5 09/13] hw/block/nvme: parameterize nvme_ns_nlbas
Date: Tue, 16 Mar 2021 16:34:27 +0900 [thread overview]
Message-ID: <20210316073427.GA2794@localhost.localdomain> (raw)
In-Reply-To: <YFBb7NdIrbzkftIc@apples.localdomain>
On 21-03-16 08:19:08, Klaus Jensen wrote:
> On Mar 16 15:53, Minwoo Im wrote:
> > On 21-03-10 10:53:43, Klaus Jensen wrote:
> > > From: Klaus Jensen <k.jensen@samsung.com>
> > >
> > > Provide a more flexible nlbas helper.
> > >
> > > Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> > > ---
> > > hw/block/nvme-ns.h | 14 ++++++++++----
> > > 1 file changed, 10 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
> > > index 07e16880801d..34f9474a1cd1 100644
> > > --- a/hw/block/nvme-ns.h
> > > +++ b/hw/block/nvme-ns.h
> > > @@ -136,12 +136,18 @@ static inline bool nvme_ns_ext(NvmeNamespace *ns)
> > > }
> > >
> > > /* calculate the number of LBAs that the namespace can accomodate */
> > > +static inline uint64_t __nvme_nlbas(size_t size, uint8_t lbads, uint16_t ms)
> > > +{
> > > + if (ms) {
> > > + return size / ((1 << lbads) + ms);
> > > + }
> > > +
> > > + return size >> lbads;
> > > +}
> > > +
> > > static inline uint64_t nvme_ns_nlbas(NvmeNamespace *ns)
> > > {
> > > - if (nvme_msize(ns)) {
> > > - return ns->size / (nvme_lsize(ns) + nvme_msize(ns));
> > > - }
> > > - return ns->size >> nvme_ns_lbads(ns);
> > > + return __nvme_nlbas(ns->size, nvme_ns_lbads(ns), nvme_msize(ns));
> > > }
> >
> > Hmm.. I think it looks like __nvme_nlbas does the same with the
> > nvme_ns_nlbas, but flexible argument attributes. But I think those
> > three attributes are all for ns-specific fields which is not that
> > generic so that I don't think we are going to take the helper from much
> > more general perspective with __nvme_nlbas.
> >
>
> This patch should be moved two patches forward in the series - it is
> used in [12/13] to check the zone geometry before the values are set on
> the namespace proper. This is also used in Format NVM to verify the
> format before formatting ("commiting" the values on the NvmeNamespace
> structure).
Checked [12/13] right before. Thanks for pointing that out!
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
next prev parent reply other threads:[~2021-03-16 7:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 9:53 [PATCH v5 00/13] hw/block/nvme: metadata and end-to-end data protection support Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 01/13] hw/block/nvme: fix zone management receive reporting too many zones Klaus Jensen
2021-03-14 19:31 ` Dmitry Fomichev
2021-03-15 18:59 ` Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 02/13] hw/block/nvme: add metadata support Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 03/13] hw/block/nvme: end-to-end data protection Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 04/13] hw/block/nvme: add verify command Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 05/13] hw/block/nvme: add non-mdts command size limit for verify Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 06/13] hw/block/nvme: support multiple lba formats Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 07/13] hw/block/nvme: prefer runtime helpers instead of device parameters Klaus Jensen
2021-03-16 6:47 ` Minwoo Im
2021-03-10 9:53 ` [PATCH v5 08/13] hw/block/nvme: pull lba format initialization Klaus Jensen
2021-03-16 6:49 ` Minwoo Im
2021-03-10 9:53 ` [PATCH v5 09/13] hw/block/nvme: parameterize nvme_ns_nlbas Klaus Jensen
2021-03-16 6:53 ` Minwoo Im
2021-03-16 7:19 ` Klaus Jensen
2021-03-16 7:34 ` Minwoo Im [this message]
2021-03-10 9:53 ` [PATCH v5 10/13] hw/block/nvme: remove invalid zone resource checks Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 11/13] hw/block/nvme: move zoned constraints checks Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 12/13] hw/block/nvme: split zone check/set geometry Klaus Jensen
2021-03-10 9:53 ` [PATCH v5 13/13] hw/block/nvme: add support for the format nvm command Klaus Jensen
2021-03-15 22:23 ` [PATCH v5 00/13] hw/block/nvme: metadata and end-to-end data protection support Klaus Jensen
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=20210316073427.GA2794@localhost.localdomain \
--to=minwoo.im.dev@gmail.com \
--cc=anaidu.gollu@samsung.com \
--cc=fam@euphon.net \
--cc=its@irrelevant.dk \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).