Skip to contentSkip to conversation

nvmet-tcp: fix stale comment on NVMET_TCP_MAXH2CDATA

PATCH Superseded Ing. Alfonso Kuen Arroyo 3 participants 4 messages Sep 19 – Sep 22

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet-tcp: fix stale comment on NVMET_TCP_MAXH2CDATA

The constant is 0x400000, 4 MiB, but the comment next to it still says 16M. Noticed by Maurizio Lombardi while reviewing "nvmet-tcp: report a bounded MDTS instead of "no limit"".

---
 drivers/nvme/target/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/tcp.c +1 -1
index e598101..726e05b 100644
@@ -23,7 +23,7 @@
 #include "nvmet.h"
 
 #define NVMET_TCP_DEF_INLINE_DATA_SIZE	(4 * PAGE_SIZE)
-#define NVMET_TCP_MAXH2CDATA		0x400000 /* 16M arbitrary limit */
+#define NVMET_TCP_MAXH2CDATA		0x400000 /* 4M arbitrary limit */
 #define NVMET_TCP_BACKLOG 128
 
 static int param_store_val(const char *str, int *val, int min, int max)

--
2.53.0

#1 lore raw

drivers/nvme/target/tcp.c line 26

Quoted 3 lines · Ing. Alfonso Kuen Arroyo

#define NVMET_TCP_DEF_INLINE_DATA_SIZE (4 * PAGE_SIZE)

drivers/nvme/target/tcp.c +1 -1
-#define NVMET_TCP_MAXH2CDATA		0x400000 /* 16M arbitrary limit */
+#define NVMET_TCP_MAXH2CDATA		0x400000 /* 4M arbitrary limit */

Maybe use SZ_4M instead of having a value and a comment that can get out of sync?

#2 lore raw
Quoted 2 lines · Christoph Hellwig

Maybe use SZ_4M instead of having a value and a comment that can get out of sync?

Good call - that also gets rid of the case Maurizio flagged (a value and a human-maintained comment that describe the same number and can drift independently). v2 below; the file doesn't pull in linux/sizes.h yet (checked, no other SZ_ user in it), so it needs the include.

Signed-off-by Alfonso Kuen
---
 drivers/nvme/target/tcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/tcp.c +2 -1
@@ -18,12 +18,13 @@
 #include <net/handshake.h>
 #include <linux/inet.h>
 #include <linux/llist.h>
+#include <linux/sizes.h>
 #include <trace/events/sock.h>
 
 #include "nvmet.h"
 
 #define NVMET_TCP_DEF_INLINE_DATA_SIZE	(4 * PAGE_SIZE)
-#define NVMET_TCP_MAXH2CDATA		0x400000 /* 16M arbitrary limit */
+#define NVMET_TCP_MAXH2CDATA		SZ_4M
 #define NVMET_TCP_BACKLOG 128
 
 static int param_store_val(const char *str, int *val, int min, int max)

--
2.53.0

Alfonso

#3 lore raw
Quoted 23 lines · Ing. Alfonso Kuen Arroyo
Quoted 2 lines · Christoph Hellwig

Maybe use SZ_4M instead of having a value and a comment that can get out of sync?

Good call - that also gets rid of the case Maurizio flagged (a value and a human-maintained comment that describe the same number and can drift independently). v2 below; the file doesn't pull in linux/sizes.h yet (checked, no other SZ_ user in it), so it needs the include.

Signed-off-by Alfonso Kuen
---
 drivers/nvme/target/tcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/tcp.c +1 -0
@@ -18,12 +18,13 @@
 #include <net/handshake.h>
 #include <linux/inet.h>
 #include <linux/llist.h>
+#include <linux/sizes.h>
 #include <trace/events/sock.h>

drivers/nvme/target/tcp.c

Quoted 10 lines
drivers/nvme/target/tcp.c +1 -2
 
 #include "nvmet.h"
 
 #define NVMET_TCP_DEF_INLINE_DATA_SIZE	(4 * PAGE_SIZE)
-#define NVMET_TCP_MAXH2CDATA		0x400000 /* 16M arbitrary limit */
+#define NVMET_TCP_MAXH2CDATA		SZ_4M
 #define NVMET_TCP_BACKLOG 128
 
 static int param_store_val(const char *str, int *val, int min, int max)
--

Looks good to me, but you should formally submit it with subject "PATCH V2" and proper commit message.

Maurizio