All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet: propagate npwg and awupf topology
@ 2024-12-12  3:31 Luis Chamberlain
  2024-12-12  5:52 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Luis Chamberlain @ 2024-12-12  3:31 UTC (permalink / raw)
  To: hch, sagi, kch; +Cc: linux-nvme, gost.dev, mcgrof

Ensure we propagate npwg and awupf to the target as well instead
of assuming its the same logical blocks per physical block.

This ensures devices with large IUs and large atomics get their
information properly propagated on the target.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/nvme/target/io-cmd-bdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 0bda83d0fc3e..567e5ac49fb0 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -26,7 +26,8 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
 	 */
 	id->nsfeat |= 1 << 1;
 	id->nawun = lpp0b;
-	id->nawupf = lpp0b;
+	id->nawupf = to0based(bdev_atomic_write_unit_max_bytes(bdev) /
+			      bdev_logical_block_size(bdev));
 	id->nacwu = lpp0b;
 
 	/*
@@ -36,7 +37,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 */
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-13 23:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12  3:31 [PATCH] nvmet: propagate npwg and awupf topology Luis Chamberlain
2024-12-12  5:52 ` Christoph Hellwig
2024-12-12 11:25   ` John Garry
2024-12-13 23:13     ` Luis Chamberlain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.