diff options
| author | Keith Busch <kbusch@kernel.org> | 2024-11-01 12:29:40 -0700 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2024-11-11 09:49:49 -0800 |
| commit | e2758c76a0ab2032a0d11abc1c2ff08661fdf428 (patch) | |
| tree | a3f2616bc93677da4a8c40451468c0555c74fde6 /drivers/nvme | |
| parent | 5fd075cdaf3649000677d960fd9e45c08081b7e0 (diff) | |
| download | linux-next-e2758c76a0ab2032a0d11abc1c2ff08661fdf428.tar.gz linux-next-e2758c76a0ab2032a0d11abc1c2ff08661fdf428.zip | |
nvmet: support for csi identify ns
Implements reporting the I/O Command Set Independent Identify Namespace
command.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'drivers/nvme')
| -rw-r--r-- | drivers/nvme/target/admin-cmd.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 33b7ecfee3fe..0a9fdc533186 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c @@ -912,6 +912,35 @@ out: 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 = cpu_to_le32(req->ns->anagrpid); + id->nmic = NVME_NS_NMIC_SHARED; + 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); +} + static void nvmet_execute_identify(struct nvmet_req *req) { if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE)) @@ -959,6 +988,9 @@ static void nvmet_execute_identify(struct nvmet_req *req) case NVME_ID_CNS_NS_ACTIVE_LIST_CS: nvmet_execute_identify_nslist(req, true); return; + case NVME_ID_CNS_NS_CS_INDEP: + nvmet_execute_id_cs_indep(req); + return; case NVME_ID_CNS_ENDGRP_LIST: nvmet_execute_identify_endgrp_list(req); return; |
