[PATCH 1/6] nvme: add preferred I/O size fields to struct nvme_id_ns_nvm

Caleb Sander Mateos posted 6 patches 1 month, 1 week ago
[PATCH 1/6] nvme: add preferred I/O size fields to struct nvme_id_ns_nvm
Posted by Caleb Sander Mateos 1 month, 1 week ago
A subsequent change will use the NPDGL and NPDAL fields of the NVM
Command Set Specific Identify Namespace structure, so add them (and the
handful of intervening fields) to struct nvme_id_ns_nvm.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 include/linux/nvme.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 655d194f8e72..bc991d4ae89d 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -511,11 +511,16 @@ struct nvme_id_ctrl_zns {
 struct nvme_id_ns_nvm {
 	__le64	lbstm;
 	__u8	pic;
 	__u8	rsvd9[3];
 	__le32	elbaf[64];
-	__u8	rsvd268[3828];
+	__le32	npdgl;
+	__le32	nprg;
+	__le32	npra;
+	__le32	nors;
+	__le32	npdal;
+	__u8	rsvd288[3808];
 };
 
 enum {
 	NVME_ID_NS_NVM_STS_MASK		= 0x7f,
 	NVME_ID_NS_NVM_GUARD_SHIFT	= 7,
-- 
2.45.2
Re: [PATCH 1/6] nvme: add preferred I/O size fields to struct nvme_id_ns_nvm
Posted by Christoph Hellwig 1 month, 1 week ago
On Thu, Feb 19, 2026 at 08:28:04PM -0700, Caleb Sander Mateos wrote:
> A subsequent change will use the NPDGL and NPDAL fields of the NVM
> Command Set Specific Identify Namespace structure, so add them (and the
> handful of intervening fields) to struct nvme_id_ns_nvm.

Looks good.  Btw, as the kernel now has a the global scope static_assert,
can you add that too any on the wire format struct you touch to ensure
our modifications aren't changing the sizses?

Signed-off-by: Christoph Hellwig <hch@lst.de>
Re: [PATCH 1/6] nvme: add preferred I/O size fields to struct nvme_id_ns_nvm
Posted by Caleb Sander Mateos 1 month, 1 week ago
On Fri, Feb 20, 2026 at 8:06 AM Christoph Hellwig <hch@lst.de> wrote:
>
> On Thu, Feb 19, 2026 at 08:28:04PM -0700, Caleb Sander Mateos wrote:
> > A subsequent change will use the NPDGL and NPDAL fields of the NVM
> > Command Set Specific Identify Namespace structure, so add them (and the
> > handful of intervening fields) to struct nvme_id_ns_nvm.
>
> Looks good.  Btw, as the kernel now has a the global scope static_assert,
> can you add that too any on the wire format struct you touch to ensure
> our modifications aren't changing the sizses?

Looks like static_assert() was added 3 years before struct nvme_id_ns_nvm :)
Definitely agree it's good to assert on these struct sizes.

>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Assuming you meant "Reviewed-by". Let me know if you meant something else.

Thanks,
Caleb
Re: [PATCH 1/6] nvme: add preferred I/O size fields to struct nvme_id_ns_nvm
Posted by Christoph Hellwig 1 month, 1 week ago
On Fri, Feb 20, 2026 at 06:55:25PM -0800, Caleb Sander Mateos wrote:
> Looks like static_assert() was added 3 years before struct nvme_id_ns_nvm :)
> Definitely agree it's good to assert on these struct sizes.
> 
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Assuming you meant "Reviewed-by". Let me know if you meant something else.

Yes, sorry.