Skip to contentSkip to conversation

nvmet-tcp: constify static struct nvmet_fabrics_ops

PATCH Applied Max Gurtovoy 4 participants 4 messages Jun 1, 2020 – Jun 9, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet-tcp: constify static struct nvmet_fabrics_ops

nvmet_tcp_ops is never modified and can be made const to allow the compiler to put it in read-only memory, as done in other transports.

Before:
text data bss dec hex filename
16164 160 12 16336 3fd0 drivers/nvme/target/tcp.o

After:
text data bss dec hex filename
16277 64 12 16353 3fe1 drivers/nvme/target/tcp.o

---
 drivers/nvme/target/tcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +2 -2
index 6f557db..9e4cb90 100644
@@ -153,7 +153,7 @@ struct nvmet_tcp_port {
 static DEFINE_MUTEX(nvmet_tcp_queue_mutex);
 
 static struct workqueue_struct *nvmet_tcp_wq;
-static struct nvmet_fabrics_ops nvmet_tcp_ops;
+static const struct nvmet_fabrics_ops nvmet_tcp_ops;
 static void nvmet_tcp_free_cmd(struct nvmet_tcp_cmd *c);
 static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd);
 
@@ -1747,7 +1747,7 @@ static void nvmet_tcp_disc_port_addr(struct nvmet_req *req,
 	}
 }
 
-static struct nvmet_fabrics_ops nvmet_tcp_ops = {
+static const struct nvmet_fabrics_ops nvmet_tcp_ops = {
 	.owner			= THIS_MODULE,
 	.type			= NVMF_TRTYPE_TCP,
 	.msdbd			= 1,
Signature · 7 lines
1.8.3.1


_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Max Gurtovoy

nvmet_tcp_ops is never modified and can be made const to allow the compiler to put it in read-only memory, as done in other transports.

Before:
text data bss dec hex filename
16164 160 12 16336 3fd0 drivers/nvme/target/tcp.o

After:
text data bss dec hex filename
16277 64 12 16353 3fe1 drivers/nvme/target/tcp.o

---
  drivers/nvme/target/tcp.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +1 -1
index 6f557db..9e4cb90 100644
@@ -153,7 +153,7 @@ struct nvmet_tcp_port {
  static DEFINE_MUTEX(nvmet_tcp_queue_mutex);
 
  static struct workqueue_struct *nvmet_tcp_wq;
-static struct nvmet_fabrics_ops nvmet_tcp_ops;
+static const struct nvmet_fabrics_ops nvmet_tcp_ops;
  static void nvmet_tcp_free_cmd(struct nvmet_tcp_cmd *c);
  static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd);
 

drivers/nvme/target/tcp.c static void nvmet_tcp_disc_port_addr(struct nvmet_req *req, · line 1753

Quoted 8 lines
drivers/nvme/target/tcp.c +1 -1
@@ -1747,7 +1747,7 @@ static void nvmet_tcp_disc_port_addr(struct nvmet_req *req,
  	}
  }
 
-static struct nvmet_fabrics_ops nvmet_tcp_ops = {
+static const struct nvmet_fabrics_ops nvmet_tcp_ops = {
  	.owner			= THIS_MODULE,
  	.type			= NVMF_TRTYPE_TCP,
  	.msdbd			= 1,
Signature · 6 lines
Himanshu Madhani                     Oracle Linux Engineering

_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme