]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nvmet: use NVME_NS_FEAT_OPTPERF_SHIFT
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 27 Feb 2026 20:23:52 +0000 (13:23 -0700)
committerKeith Busch <kbusch@kernel.org>
Fri, 27 Mar 2026 14:35:04 +0000 (07:35 -0700)
Use the NVME_NS_FEAT_OPTPERF_SHIFT constant in nvmet_bdev_set_limits()
to set the OPTPERF bits of the nvme_id_ns NSFEAT field instead of the
magic number 4.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/io-cmd-bdev.c

index f15d1c213bc6b40113f5b5bc652aa38f5bbb6f57..a8a7d3a88ef20f31c76bf7006838b137785f7af3 100644 (file)
@@ -30,11 +30,11 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
        id->nacwu = lpp0b;
 
        /*
-        * Bit 4 indicates that the fields NPWG, NPWA, NPDG, NPDA, and
+        * OPTPERF = 01b indicates that the fields NPWG, NPWA, NPDG, NPDA, and
         * NOWS are defined for this namespace and should be used by
         * the host for I/O optimization.
         */
-       id->nsfeat |= 1 << 4;
+       id->nsfeat |= 0x1 << NVME_NS_FEAT_OPTPERF_SHIFT;
        /* NPWG = Namespace Preferred Write Granularity. 0's based */
        id->npwg = to0based(bdev_io_min(bdev) / bdev_logical_block_size(bdev));
        /* NPWA = Namespace Preferred Write Alignment. 0's based */