Skip to contentSkip to conversation

nvme-cli: add default value for nsid of write-zeroes

PATCH New Minwoo Im 4 participants 5 messages Jun 1, 2019 – Jun 3, 2019 NVMe

lore
Share & tools
lore

Minwoo Im

author
#0 lore raw

PATCH 1/1 nvme-cli: add default value for nsid of write-zeroes

-L 3772,3778 is doing the default value check and update the nsid if it's not given by the input:

	if (!cfg.namespace_id) {
		cfg.namespace_id = get_nsid(fd);
		if (cfg.namespace_id == 0) {
			err = EINVAL;
			goto close_fd;
		}
	}

This patch adds nsid default value to zero for the case user does not give the nsid input.

Cc Keith Busch <kbusch at kernel.org>
Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>
---
 nvme.c | 1 +
 1 file changed, 1 insertion(+)
nvme.c +1 -0
index 9819fcb..a7a96a1 100644
@@ -3731,6 +3731,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
 
 	struct config cfg = {
 		.start_block     = 0,
+		.namespace_id    = 0,
 		.block_count     = 0,
 		.prinfo          = 0,
 		.ref_tag         = 0,
Signature · 1 line
2.21.0
maintainer
#1 lore raw

PATCH 1/1 nvme-cli: add default value for nsid of write-zeroes

nvme.c static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi · line 3734

Quoted 10 lines
nvme.c +1 -0
index 9819fcb..a7a96a1 100644
@@ -3731,6 +3731,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
 
  	struct config cfg = {
  		.start_block     = 0,
+		.namespace_id    = 0,

This is implicitly set to 0. You should mention that you add this just for clarification, and its not fixing a bug.

#2 lore raw

PATCH 1/1 nvme-cli: add default value for nsid of write-zeroes

Quoted 11 lines · Sagi Grimberg

nvme.c static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi · line 3734

Quoted 9 lines
nvme.c +1 -0
index 9819fcb..a7a96a1 100644
@@ -3731,6 +3731,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
 
  	struct config cfg = {
  		.start_block     = 0,
+		.namespace_id    = 0,

This is implicitly set to 0. You should mention that you add this just for clarification, and its not fixing a bug.

Is this breaking any testcases or expected behavior ?

Quoted 5 lines

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

#4 lore raw

PATCH 1/1 nvme-cli: add default value for nsid of write-zeroes

In reply to Sagi Grimberg
Quoted 2 lines

This is implicitly set to 0. You should mention that you add this just for clarification, and its not fixing a bug.

Hi Sagi,

Thanks for pointing it out. I should have made the commit more in detail. As you mentioned, the ommitted field members are implicitly initialized to zero by the C99.

I think it can be ignored here.

Thanks :)

#3 lore raw

PATCH 1/1 nvme-cli: add default value for nsid of write-zeroes

In reply to Chaitanya Kulkarni
Quoted 1 line

Is this breaking any testcases or expected behavior ?

Hi Chaitanya,

Thanks for your question. As I replied to Sagi, This patch can be ignored. Sorry for making confusions here. This patch has never caused any issues ever.

Thanks,