* [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
* Re: [PATCH] nvmet: propagate npwg and awupf topology
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
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2024-12-12 5:52 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: hch, sagi, kch, linux-nvme, gost.dev, John Garry
On Wed, Dec 11, 2024 at 07:31:47PM -0800, Luis Chamberlain wrote:
> 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.
nvmet never sets REQ_ATOMIC and thus won't get atomic writes from
say SCSI. So supporting atomic writes is a little more work than
just propagating the values.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvmet: propagate npwg and awupf topology
2024-12-12 5:52 ` Christoph Hellwig
@ 2024-12-12 11:25 ` John Garry
2024-12-13 23:13 ` Luis Chamberlain
0 siblings, 1 reply; 4+ messages in thread
From: John Garry @ 2024-12-12 11:25 UTC (permalink / raw)
To: Christoph Hellwig, Luis Chamberlain; +Cc: sagi, kch, linux-nvme, gost.dev
On 12/12/2024 05:52, Christoph Hellwig wrote:
> On Wed, Dec 11, 2024 at 07:31:47PM -0800, Luis Chamberlain wrote:
>> 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.
>
> nvmet never sets REQ_ATOMIC and thus won't get atomic writes from
> say SCSI. So supporting atomic writes is a little more work than
> just propagating the values.
>
In case missed, Mike had patches for SCSI target code:
https://lore.kernel.org/linux-scsi/20241008020437.78788-1-michael.christie@oracle.com/
I still need to check them ...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvmet: propagate npwg and awupf topology
2024-12-12 11:25 ` John Garry
@ 2024-12-13 23:13 ` Luis Chamberlain
0 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2024-12-13 23:13 UTC (permalink / raw)
To: John Garry; +Cc: Christoph Hellwig, sagi, kch, linux-nvme, gost.dev
On Thu, Dec 12, 2024 at 11:25:29AM +0000, John Garry wrote:
> I still need to check them ...
We can punt atomics later then.
Luis
^ permalink raw reply [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.