nvme: reorder fields in 'struct nvme_ctrl'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 1 May 2023 12:40:26 +0000 (14:40 +0200)
committerKeith Busch <kbusch@kernel.org>
Mon, 12 Jun 2023 17:36:42 +0000 (10:36 -0700)
Group some variables based on their sizes to reduce holes.
On x86_64, this shrinks the size of 'struct nvme_ctrl' from 5368 to 5344
bytes when all CONFIG_* are defined.

This structure is embedded into some other structures, so it helps reducing
their size as well.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/nvme.h

index 953e59f..9a585e6 100644 (file)
@@ -246,8 +246,8 @@ enum nvme_ctrl_flags {
 
 struct nvme_ctrl {
        bool comp_seen;
-       enum nvme_ctrl_state state;
        bool identified;
+       enum nvme_ctrl_state state;
        spinlock_t lock;
        struct mutex scan_lock;
        const struct nvme_ctrl_ops *ops;
@@ -279,8 +279,8 @@ struct nvme_ctrl {
        char name[12];
        u16 cntlid;
 
-       u32 ctrl_config;
        u16 mtfa;
+       u32 ctrl_config;
        u32 queue_count;
 
        u64 cap;
@@ -353,10 +353,10 @@ struct nvme_ctrl {
        bool apst_enabled;
 
        /* PCIe only: */
+       u16 hmmaxd;
        u32 hmpre;
        u32 hmmin;
        u32 hmminds;
-       u16 hmmaxd;
 
        /* Fabrics only */
        u32 ioccsz;