]> www.infradead.org Git - nvme.git/commitdiff
nvmet: propagate npwg topology
authorLuis Chamberlain <mcgrof@kernel.org>
Wed, 18 Dec 2024 02:33:25 +0000 (18:33 -0800)
committerKeith Busch <kbusch@kernel.org>
Fri, 27 Dec 2024 21:18:01 +0000 (13:18 -0800)
Ensure we propagate npwg to the target as well instead
of assuming its the same logical blocks per physical block.

This ensures devices with large IUs information properly
propagated on the target.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/io-cmd-bdev.c

index 0bda83d0fc3e08092e718233a6e0ec7070c98787..eaf31c823cbe88fc2b6500cad1bddaad1ca8c8b1 100644 (file)
@@ -36,7 +36,7 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
         */
        id->nsfeat |= 1 << 4;
        /* NPWG = Namespace Preferred Write Granularity. 0's based */
-       id->npwg = lpp0b;
+       id->npwg = to0based(bdev_io_min(bdev) / bdev_logical_block_size(bdev));
        /* NPWA = Namespace Preferred Write Alignment. 0's based */
        id->npwa = id->npwg;
        /* NPDG = Namespace Preferred Deallocate Granularity. 0's based */