Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme: Add nvme_cfg global variable for NVME_ARGS default options #2285

Merged
merged 12 commits into from
Jun 27, 2024

Conversation

ikegami-t
Copy link
Contributor

To preapare to add NVME_ARGS default option further.

@igaw
Copy link
Collaborator

igaw commented Apr 4, 2024

Good idea. I was playing around with a different idea. Let me check what I've done and if there are some more cases to cover

@igaw
Copy link
Collaborator

igaw commented Apr 9, 2024

Looking with fresh eyes on this PR, could you explain what do you want to achieve with this change? I mean I understand you want to group those two variable but if it is just that, I don't think we should introduce so much code churn.

BTW, I though you would do something similar what I a just posted in #2288

@ikegami-t
Copy link
Contributor Author

Sorry for late to do add additional patches. I thought to try the timeout default options into the NVME_ARGS since currently only some commands supported the option but seems almost libnvme APIs support the timeout parameter. If you okay about this will do continue the implementation. Anyway in future for any other default options the nvme_cfg global variable seems be able to use I think.

@igaw
Copy link
Collaborator

igaw commented Apr 10, 2024

Sounds alright, the only thing to keep in mind, we should avoid changing existing options.

@ikegami-t
Copy link
Contributor Author

Just rebased the patch and also noted about the mention. Thank you.

@ikegami-t
Copy link
Contributor Author

The last patch for delete-ns command depended on the libnvme PR changes linux-nvme/libnvme#811.

@ikegami-t ikegami-t force-pushed the nvme-cfg branch 3 times, most recently from 0f22f7b to 37625f5 Compare April 14, 2024 04:20
@ikegami-t
Copy link
Contributor Author

Sorry the following commands short option changed as below by the commit c809879 since duplicated with the default timeout option -t added.

- nvme compare [--latency | -t]
+ nvme compare [--latency | -L]
- nvme read [--latency | -t]
+ nvme read [--latency | -L]
- nvme resv-acquire [--rtype=<rtype> | -t <rtype>]
+ nvme resv-acquire [--rtype=<rtype> | -T <rtype>]
- nvme resv-release [--rtype=<rtype> | -t <rtype>]
+ nvme resv-release [--rtype=<rtype> | -T <rtype>]
- nvme security-recv [--al=<allocation-length> | -t <allocation-length>]
+ nvme security-recv [--al=<allocation-length> | -l <allocation-length>]
- nvme security-recv [--tl=<transfer-length> | -t <transfer-length>]
+ nvme security-recv [--tl=<transfer-length> | -l <transfer-length>]
- nvme write [--latency | -t]
+ nvme write [--latency | -L]

@igaw
Copy link
Collaborator

igaw commented Apr 24, 2024

That means we would change existing options once again. The last time it introduced regressions and I promised to avoid this in future. See https://lore.kernel.org/linux-nvme/xfypo2wloir5l3wrw4aodzjekertc4dlnb7dvk2i5egiqwo3ao@rokmuhzvvcfe/

I think we could avoid this by just introducing --timeout on global level and update the existing commands which support the short form also to accept -t. Hopefully this is not getting too messy.

@ikegami-t
Copy link
Contributor Author

Okay I see so will do consider the suggestion to keep the existing commands. Thank you.

@ikegami-t
Copy link
Contributor Author

Just fixed the short option change issue as below as changed the default timeout option order so the existing short command option -t works correctly but the timtout option -t duplicated does not work. Also reverted the changes the existing short option -t changes so now not changed from before.

  #define NVME_ARGS(n, ...)                                                              \
  	struct argconfig_commandline_options n[] = {                                   \
  		OPT_INCR("verbose",      'v', &nvme_cfg.verbose,       verbose),       \
  		OPT_FMT("output-format", 'o', &nvme_cfg.output_format, output_format), \
-  		OPT_UINT("timeout",      't', &nvme_cfg.timeout,       timeout),       \
  		##__VA_ARGS__,                                                         \
+  		OPT_UINT("timeout",      't', &nvme_cfg.timeout,       timeout),       \
  		OPT_END()                                                              \
  	}

By the way I think we can fix the short option -o issue mentionsed by the linux-nvme mailing list as same so should we need to fix the issue also?

@igaw
Copy link
Collaborator

igaw commented Jun 13, 2024

Sorry for the late response. I was pretty busy and now I am trying to catch up.

Just fixed the short option change issue as below as changed the default timeout option order so the existing short command option -t works correctly but the timtout option -t duplicated does not work. Also reverted the changes the existing short option -t changes so now not changed from before.

Okay, sounds good to me

  #define NVME_ARGS(n, ...)                                                              \
  	struct argconfig_commandline_options n[] = {                                   \
  		OPT_INCR("verbose",      'v', &nvme_cfg.verbose,       verbose),       \
  		OPT_FMT("output-format", 'o', &nvme_cfg.output_format, output_format), \
-  		OPT_UINT("timeout",      't', &nvme_cfg.timeout,       timeout),       \
  		##__VA_ARGS__,                                                         \
+  		OPT_UINT("timeout",      't', &nvme_cfg.timeout,       timeout),       \
  		OPT_END()                                                              \
  	}
``

Maybe it is worth to add a comment why timeout is the last argument. E.g the ordering of the arguments matters, as the argument parser uses the first match, thus any command which defines -t shorthand will match first.

By the way I think we can fix the short option -o issue mentionsed by the linux-nvme mailing list as same so should we need to fix the issue also?

I think we just leave it as it is now. Changing it back will cause again troubles.

BTW, could you rebase the PR? Thanks!

@ikegami-t
Copy link
Contributor Author

Thanks for your review comments. Let me update the patches on next week since traveling now.

To preapare to add NVME_ARGS default option further.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Replace the existing timeout options to use this instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
The timeout variable zero initialized as same with the default definition.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Change to pass the timeout value to libnvme API.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
The option added as NVME_ARGS default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Fix white spaces indentation to use tabs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Fix white spaces indentation to use tabs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
The fw-activate command is old version prior to 1.2.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
The nvme-mi-recv/send and get/set-reg commands missed it.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Missed to add the commands completions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Added the option as a nvme default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Added the option as a nvme default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
@ikegami-t
Copy link
Contributor Author

Just fixed the comment and rebased the patches.

@igaw igaw merged commit d35bccd into linux-nvme:master Jun 27, 2024
16 of 17 checks passed
@igaw
Copy link
Collaborator

igaw commented Jun 27, 2024

Thanks a lot! This was a major cleanup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants