Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: martin.petersen@oracle.com (Martin K. Petersen)
Subject: [PATCH v2 3/3] nvme: Set physical block size and optimal I/O size according to NVMe 1.4
Date: Wed, 12 Jun 2019 21:53:29 -0400	[thread overview]
Message-ID: <yq15zpa2que.fsf@oracle.com> (raw)
In-Reply-To: <20190610210612.103952-4-bvanassche@acm.org> (Bart Van Assche's message of "Mon, 10 Jun 2019 14:06:12 -0700")


Bart,

> +	nawupf = (1 + ns->ctrl->subsys->awupf) * bs;
> +	if (id->nsfeat & (1 << 1))
> +		nawupf = (1 + id->nawupf) * bs;

This tripped me up a bit. I would have preferred an else statement and
maybe a clarifying comment to make it obvious whether the value comes
from the controller or the namespace.

Also, unlike awupf, nawupf is not a 0-based value (0 means "use awupf"
and not 1 logical block).

And finally, I think it's confusing that you use nawupf for the variable
name post modification. In terms of naming, I think you'd be better off
to do s/nawupf/phys_bs/ or atomic_bs. And then rename your existing
phys_bs variable to io_min to match the existing block layer usage.

So something like:

        /* Use reported namespace write atomicity */
	if (id->nsfeat & (1 << 1) && id->nawupf != 0)
           phys_bs = id->nawupf * bs;
        else /* Fall back to reported controller write atomicity */
           phys_bs = (1 + ns->ctrl->subsys->awupf) * bs;

[...]

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2019-06-13  1:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 21:06 [PATCH v2 0/3] NVMe 1.4 Identify Namespace Support Bart Van Assche
2019-06-10 21:06 ` [PATCH v2 1/3] nvme: Introduce NVMe 1.4 Identify Namespace fields in struct nvme_id_ns Bart Van Assche
2019-06-10 21:06 ` [PATCH v2 2/3] nvmet: Export NVMe namespace attributes Bart Van Assche
2019-06-14  4:42   ` Chaitanya Kulkarni
2019-06-14 15:31     ` Bart Van Assche
2019-06-14 17:18       ` Chaitanya Kulkarni
2019-06-14 17:43         ` Bart Van Assche
2019-06-14 17:53           ` Chaitanya Kulkarni
2019-06-14 23:56         ` Bart Van Assche
2019-06-10 21:06 ` [PATCH v2 3/3] nvme: Set physical block size and optimal I/O size according to NVMe 1.4 Bart Van Assche
2019-06-13  1:53   ` Martin K. Petersen [this message]
2019-06-13 17:57     ` Bart Van Assche
2019-06-13 23:57       ` Martin K. Petersen

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=yq15zpa2que.fsf@oracle.com \
    --to=martin.petersen@oracle.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