nvmet: set the LBCC bit for commands that modify data
authorChristoph Hellwig <hch@lst.de>
Mon, 12 Dec 2022 14:20:56 +0000 (15:20 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 28 Dec 2022 16:26:13 +0000 (06:26 -1000)
Write, Write Zeroes, Zone append and a Zone Reset through
Zone Management Send modify the logical block content of a namespace,
so make sure the LBCC bit is reported for them.

Fixes: b5d0b38c0475 ("nvmet: add Command Set Identifier support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
drivers/nvme/target/admin-cmd.c

index 111a5cb6403fb0b23b83b3ca382ae6ff63b109c8..6a54ed6fb1214404d7738bf32c7b14d2441ee6d6 100644 (file)
@@ -174,17 +174,19 @@ static void nvmet_get_cmd_effects_nvm(struct nvme_effects_log *log)
                cpu_to_le32(NVME_CMD_EFFECTS_CSUPP);
 
        log->iocs[nvme_cmd_read] =
-       log->iocs[nvme_cmd_write] =
        log->iocs[nvme_cmd_flush] =
        log->iocs[nvme_cmd_dsm] =
-       log->iocs[nvme_cmd_write_zeroes] =
                cpu_to_le32(NVME_CMD_EFFECTS_CSUPP);
+       log->iocs[nvme_cmd_write] =
+       log->iocs[nvme_cmd_write_zeroes] =
+               cpu_to_le32(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC);
 }
 
 static void nvmet_get_cmd_effects_zns(struct nvme_effects_log *log)
 {
        log->iocs[nvme_cmd_zone_append] =
        log->iocs[nvme_cmd_zone_mgmt_send] =
+               cpu_to_le32(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC);
        log->iocs[nvme_cmd_zone_mgmt_recv] =
                cpu_to_le32(NVME_CMD_EFFECTS_CSUPP);
 }