Skip to content

Commit 61c9967

Browse files
committed
nvmet: implement active command set ns list
This is required for nvme 2.1 for targets that support multiple command sets. We support NVM and ZNS, so are required to support this identification. Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Matias Bjørling <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 64a5108 commit 61c9967

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/nvme/target/admin-cmd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)
592592
nvmet_req_complete(req, status);
593593
}
594594

595-
static void nvmet_execute_identify_nslist(struct nvmet_req *req)
595+
static void nvmet_execute_identify_nslist(struct nvmet_req *req, bool match_css)
596596
{
597597
static const int buf_size = NVME_IDENTIFY_DATA_SIZE;
598598
struct nvmet_ctrl *ctrl = req->sq->ctrl;
@@ -622,6 +622,8 @@ static void nvmet_execute_identify_nslist(struct nvmet_req *req)
622622
xa_for_each(&ctrl->subsys->namespaces, idx, ns) {
623623
if (ns->nsid <= min_nsid)
624624
continue;
625+
if (match_css && req->ns->csi != req->cmd->identify.csi)
626+
continue;
625627
list[i++] = cpu_to_le32(ns->nsid);
626628
if (i == buf_size / sizeof(__le32))
627629
break;
@@ -728,7 +730,7 @@ static void nvmet_execute_identify(struct nvmet_req *req)
728730
nvmet_execute_identify_ctrl(req);
729731
return;
730732
case NVME_ID_CNS_NS_ACTIVE_LIST:
731-
nvmet_execute_identify_nslist(req);
733+
nvmet_execute_identify_nslist(req, false);
732734
return;
733735
case NVME_ID_CNS_NS_DESC_LIST:
734736
nvmet_execute_identify_desclist(req);
@@ -759,6 +761,9 @@ static void nvmet_execute_identify(struct nvmet_req *req)
759761
break;
760762
}
761763
break;
764+
case NVME_ID_CNS_NS_ACTIVE_LIST_CS:
765+
nvmet_execute_identify_nslist(req, true);
766+
return;
762767
}
763768

764769
pr_debug("unhandled identify cns %d on qid %d\n",

include/linux/nvme.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ enum {
522522
NVME_ID_CNS_NS_DESC_LIST = 0x03,
523523
NVME_ID_CNS_CS_NS = 0x05,
524524
NVME_ID_CNS_CS_CTRL = 0x06,
525+
NVME_ID_CNS_NS_ACTIVE_LIST_CS = 0x07,
525526
NVME_ID_CNS_NS_CS_INDEP = 0x08,
526527
NVME_ID_CNS_NS_PRESENT_LIST = 0x10,
527528
NVME_ID_CNS_NS_PRESENT = 0x11,

0 commit comments

Comments
 (0)