From: Christoph Hellwig <hch@lst.de>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: linux-nvme@lists.infradead.org, hch@lst.de, kbusch@kernel.org,
sagi@grimberg.me, damien.lemoal@wdc.com
Subject: Re: [PATCH V10 4/8] nvmet: add ZBD over ZNS backend support
Date: Tue, 9 Mar 2021 12:41:27 +0100 [thread overview]
Message-ID: <20210309114127.GD9520@lst.de> (raw)
In-Reply-To: <20210309045823.18545-5-chaitanya.kulkarni@wdc.com>
On Mon, Mar 08, 2021 at 08:58:19PM -0800, Chaitanya Kulkarni wrote:
> NVMe TP 4053 – Zoned Namespaces (ZNS) allows host software to
> communicate with a non-volatile memory subsystem using zones for
> NVMe protocol based controllers. NVMeOF already support the ZNS NVMe
> Protocol compliant devices on the target in the passthru mode. There
> are Generic zoned block devices like Shingled Magnetic Recording (SMR)
> HDDs that are not based on the NVMe protocol.
>
> This patch adds ZNS backend to support the ZBDs for NVMeOF target.
>
> This support includes implementing the new command set NVME_CSI_ZNS,
> adding different command handlers for ZNS command set such as
> NVMe Identify Controller, NVMe Identify Namespace, NVMe Zone Append,
> NVMe Zone Management Send and NVMe Zone Management Receive.
>
> With new command set identifier we also update the target command effects
> logs to reflect the ZNS compliant commands.
>
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
> drivers/nvme/target/Makefile | 1 +
> drivers/nvme/target/admin-cmd.c | 8 +
> drivers/nvme/target/io-cmd-bdev.c | 33 +++-
> drivers/nvme/target/nvmet.h | 38 ++++
> drivers/nvme/target/zns.c | 308 ++++++++++++++++++++++++++++++
> 5 files changed, 380 insertions(+), 8 deletions(-)
> create mode 100644 drivers/nvme/target/zns.c
>
> diff --git a/drivers/nvme/target/Makefile b/drivers/nvme/target/Makefile
> index ebf91fc4c72e..9837e580fa7e 100644
> --- a/drivers/nvme/target/Makefile
> +++ b/drivers/nvme/target/Makefile
> @@ -12,6 +12,7 @@ obj-$(CONFIG_NVME_TARGET_TCP) += nvmet-tcp.o
> nvmet-y += core.o configfs.o admin-cmd.o fabrics-cmd.o \
> discovery.o io-cmd-file.o io-cmd-bdev.o
> nvmet-$(CONFIG_NVME_TARGET_PASSTHRU) += passthru.o
> +nvmet-$(CONFIG_BLK_DEV_ZONED) += zns.o
> nvme-loop-y += loop.o
> nvmet-rdma-y += rdma.o
> nvmet-fc-y += fc.o
> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
> index 76d9fc0f48c2..05ef362d70b7 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -719,8 +719,16 @@ static void nvmet_execute_identify(struct nvmet_req *req)
> switch (req->cmd->identify.cns) {
> case NVME_ID_CNS_NS:
> return nvmet_execute_identify_ns(req);
> + case NVME_ID_CNS_CS_NS:
> + if (req->cmd->identify.csi == NVME_CSI_ZNS)
> + return nvmet_execute_identify_cns_cs_ns(req);
> + break;
> case NVME_ID_CNS_CTRL:
> return nvmet_execute_identify_ctrl(req);
> + case NVME_ID_CNS_CS_CTRL:
> + if (req->cmd->identify.csi == NVME_CSI_ZNS)
> + return nvmet_execute_identify_cns_cs_ctrl(req);
> + break;
I still find the way how this mixes the CNS and CSI fields in a single
switch weird. I'd expect an outer switch for CNS and an inner one for
the CSI value.
> +static u16 nvmet_bdev_zns_checks(struct nvmet_req *req)
> +{
> + if (!bdev_is_zoned(req->ns->bdev))
> + return NVME_SC_INVALID_NS | NVME_SC_DNR;
> +
> + if (req->cmd->zmr.zra != NVME_ZRA_ZONE_REPORT)
> + return NVME_SC_INVALID_FIELD;
> +
> + if (req->cmd->zmr.zrasf != NVME_ZRASF_ZONE_REPORT_ALL)
> + return NVME_SC_INVALID_FIELD;
> +
> + if (req->cmd->zmr.pr != NVME_REPORT_ZONE_PARTIAL)
> + return NVME_SC_INVALID_FIELD;
error_loc information would be useful here.
> +static inline bool nvmet_zns_update_zasl(struct nvmet_ns *ns)
> +{
> + struct request_queue *q = ns->bdev->bd_disk->queue;
> + u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q));
> +
> + if (ns->subsys->zasl)
> + return ns->subsys->zasl < zasl ? false : true;
No need for the tenary expression here, the comparism will autoconvert to
bool.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-03-09 11:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 4:58 [PATCH V10 0/8] nvmet: add ZBD backend support Chaitanya Kulkarni
2021-03-09 4:58 ` [PATCH V10 1/8] nvmet: trim args for nvmet_copy_ns_identifier() Chaitanya Kulkarni
2021-03-09 11:34 ` Christoph Hellwig
2021-03-09 20:54 ` Chaitanya Kulkarni
2021-03-09 21:03 ` Chaitanya Kulkarni
2021-03-10 8:49 ` Christoph Hellwig
2021-03-10 8:52 ` Chaitanya Kulkarni
2021-03-09 4:58 ` [PATCH V10 2/8] nvmet: add NVM Command Set Identifier support Chaitanya Kulkarni
2021-03-09 11:37 ` Christoph Hellwig
2021-03-09 21:07 ` Chaitanya Kulkarni
2021-03-09 4:58 ` [PATCH V10 3/8] nvmet: add command set supported ctrl cap Chaitanya Kulkarni
2021-03-09 11:38 ` Christoph Hellwig
2021-03-09 21:09 ` Chaitanya Kulkarni
2021-03-10 7:05 ` Chaitanya Kulkarni
2021-03-10 7:14 ` hch
2021-03-09 4:58 ` [PATCH V10 4/8] nvmet: add ZBD over ZNS backend support Chaitanya Kulkarni
2021-03-09 11:41 ` Christoph Hellwig [this message]
2021-03-09 21:13 ` Chaitanya Kulkarni
2021-03-09 4:58 ` [PATCH V10 5/8] nvmet: add nvmet_req_bio put helper for backends Chaitanya Kulkarni
2021-03-09 4:58 ` [PATCH V10 6/8] nvme-core: check ctrl css before setting up zns Chaitanya Kulkarni
2021-03-09 11:42 ` Christoph Hellwig
2021-03-09 15:03 ` Christoph Hellwig
2021-03-10 1:14 ` Chaitanya Kulkarni
2021-03-09 4:58 ` [PATCH V10 7/8] nvme-core: add a helper to print css related error Chaitanya Kulkarni
2021-03-09 4:58 ` [PATCH V10 8/8] nvme: add comments to nvme_zns_alloc_report_buffer Chaitanya Kulkarni
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=20210309114127.GD9520@lst.de \
--to=hch@lst.de \
--cc=chaitanya.kulkarni@wdc.com \
--cc=damien.lemoal@wdc.com \
--cc=kbusch@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;
as well as URLs for NNTP newsgroup(s).