From: Christoph Hellwig <hch@lst.de>
To: "Javier González" <javier@javigon.com>
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, axboe@kernel.dk,
joshi.k@samsung.com, k.jensen@samsung.com, Niklas.Cassel@wdc.com,
"Javier González" <javier.gonz@samsung.com>
Subject: Re: [PATCH] nvme: enable ro namespace for ZNS without append
Date: Fri, 6 Nov 2020 15:14:28 +0100 [thread overview]
Message-ID: <20201106141428.GA23884@lst.de> (raw)
In-Reply-To: <20201106122637.14490-1-javier.gonz@samsung.com>
> +#ifdef CONFIG_BLK_DEV_ZONED
> + if (blk_queue_is_zoned(disk->queue) && !ns->zoned_ns_supp)
> + set_disk_ro(disk, true);
> +#endif
I think we can simplify this at bit. Add a new NVME_NS_FORCE_RO flag
to ns->flags, set it in nvme_update_zone_info, and just query it here
without any ifdefs.
> struct request_queue *q = disk->queue;
> struct nvme_command c = { };
> struct nvme_id_ns_zns *id;
> + bool zoned_ns_supp = true;
> int status;
>
> /* Driver requires zone append support */
> if (!(le32_to_cpu(log->iocs[nvme_cmd_zone_append]) &
> NVME_CMD_EFFECTS_CSUPP)) {
> + zoned_ns_supp = false;
> dev_warn(ns->ctrl->device,
> "append not supported for zoned namespace:%d\n",
> ns->head->ns_id);
> + } else {
> + /* Lazily query controller append limit for the first
> + * zoned namespace
> + */
> + if (!ns->ctrl->max_zone_append) {
> + status = nvme_set_max_append(ns->ctrl);
> + if (status)
> + return status;
> + }
While you're at it: my inverse the polarity of the if check as that reads just
a little more natural, and maybe mention in the warning that the namespace is
forced to read-only mode?
Otherwise this looks good.
next prev parent reply other threads:[~2020-11-06 14:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 12:26 [PATCH] nvme: enable ro namespace for ZNS without append Javier González
2020-11-06 14:14 ` Christoph Hellwig [this message]
2020-11-06 14:22 ` Javier González
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=20201106141428.GA23884@lst.de \
--to=hch@lst.de \
--cc=Niklas.Cassel@wdc.com \
--cc=axboe@kernel.dk \
--cc=javier.gonz@samsung.com \
--cc=javier@javigon.com \
--cc=joshi.k@samsung.com \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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