Skip to content

Commit e64b0c8

Browse files
tititiou36keithbusch
authored andcommitted
nvmet: reorder fields in 'struct nvmf_ctrl_options'
Group some variables based on their sizes to reduce holes. On x86_64, this shrinks the size of 'struct nvmf_ctrl_options' from 136 to 128 bytes. When such a structure is allocated in nvmf_create_ctrl(), because of the way memory allocation works, when 136 bytes were requested, 192 bytes were allocated. So this saves 64 bytes per allocation, 1 cache line to hold the whole structure and a few cycles when zeroing the memory in nvmf_create_ctrl(). Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 9d217fb commit e64b0c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/nvme/host/fabrics.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ enum {
7777
* with the parsing opts enum.
7878
* @mask: Used by the fabrics library to parse through sysfs options
7979
* on adding a NVMe controller.
80+
* @max_reconnects: maximum number of allowed reconnect attempts before removing
81+
* the controller, (-1) means reconnect forever, zero means remove
82+
* immediately;
8083
* @transport: Holds the fabric transport "technology name" (for a lack of
8184
* better description) that will be used by an NVMe controller
8285
* being added.
@@ -96,9 +99,6 @@ enum {
9699
* @discovery_nqn: indicates if the subsysnqn is the well-known discovery NQN.
97100
* @kato: Keep-alive timeout.
98101
* @host: Virtual NVMe host, contains the NQN and Host ID.
99-
* @max_reconnects: maximum number of allowed reconnect attempts before removing
100-
* the controller, (-1) means reconnect forever, zero means remove
101-
* immediately;
102102
* @dhchap_secret: DH-HMAC-CHAP secret
103103
* @dhchap_ctrl_secret: DH-HMAC-CHAP controller secret for bi-directional
104104
* authentication
@@ -112,6 +112,7 @@ enum {
112112
*/
113113
struct nvmf_ctrl_options {
114114
unsigned mask;
115+
int max_reconnects;
115116
char *transport;
116117
char *subsysnqn;
117118
char *traddr;
@@ -125,7 +126,6 @@ struct nvmf_ctrl_options {
125126
bool duplicate_connect;
126127
unsigned int kato;
127128
struct nvmf_host *host;
128-
int max_reconnects;
129129
char *dhchap_secret;
130130
char *dhchap_ctrl_secret;
131131
bool disable_sqflow;

0 commit comments

Comments
 (0)