[PATCHv3 09/11] nvmet: support for csi identify ns
Guixin Liu
kanie at linux.alibaba.com
Tue Nov 5 21:46:04 PST 2024
在 2024/11/6 01:49, Keith Busch 写道:
> From: Keith Busch <kbusch at kernel.org>
>
> Implements reporting the I/O Command Set Independent Identify Namespace
> command.
>
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
> drivers/nvme/target/admin-cmd.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
> index dba8940a85e35..9609bda7b5629 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -879,6 +879,35 @@ static void nvme_execute_identify_ns_nvm(struct nvmet_req *req)
> nvmet_req_complete(req, status);
> }
>
> +static void nvmet_execute_id_cs_indep(struct nvmet_req *req)
> +{
> + struct nvme_id_ns_cs_indep *id;
> + u16 status;
> +
> + status = nvmet_req_find_ns(req);
> + if (status)
> + goto out;
> +
> + id = kzalloc(sizeof(*id), GFP_KERNEL);
> + if (!id) {
> + status = NVME_SC_INTERNAL;
> + goto out;
> + }
> +
> + id->nstat = NVME_NSTAT_NRDY;
> + id->anagrpid = req->ns->anagrpid;
Should use cpu_to_le32(req->ns->anagrpid) here.
> + id->nmic = NVME_NS_NMIC_SHARED;
Nit, id->nmic |= NVME_NS_NMIC_SHARED;
Best Regards,
Guixin Liu
> + if (req->ns->readonly)
> + id->nsattr |= NVME_NS_ATTR_RO;
> + if (req->ns->bdev && !bdev_nonrot(req->ns->bdev))
> + id->nsfeat |= NVME_NS_ROTATIONAL;
> +
> + status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
> + kfree(id);
> +out:
> + nvmet_req_complete(req, status);
> +}
More information about the Linux-nvme
mailing list