[PATCH 3/3] nvmet: replace transports array with a linked list
Max Gurtovoy
mgurtovoy at nvidia.com
Mon Sep 22 14:19:59 PDT 2025
On 22/09/2025 20:35, Christoph Hellwig wrote:
> On Sun, Sep 21, 2025 at 02:49:43AM +0300, Max Gurtovoy wrote:
>> The nvmet_transports array was sized to 255 (NVMF_TRTYPE_MAX), although
>> only up to 5 transport types can ever be registered, resulting in
>> some unused memory. This change replaces the array with a linked list to
>> store registered transport ops, substantially improving memory
>> efficiency by allocating space only for active transports.
> This adds extra code and makes previously const data structures mutable
> to save a little bit of space, which feels like the wrong tradeoff.
>
> What is your motivation here?
The main goal is to save the wasted memory (even though it is no huge).
maybe we can do something like this instead:
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 655d194f8e72..8e076960875c 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -68,7 +68,7 @@ enum {
NVMF_TRTYPE_RDMA = 1, /* RDMA */
NVMF_TRTYPE_FC = 2, /* Fibre Channel */
NVMF_TRTYPE_TCP = 3, /* TCP/IP */
- NVMF_TRTYPE_LOOP = 254, /* Reserved for host usage */
+ NVMF_TRTYPE_LOOP = 15, /* Reserved for host usage */
NVMF_TRTYPE_MAX,
};
More information about the Linux-nvme
mailing list