lnvm: minor clean-ups
v2 cover lnvm: minor clean-ups
Hi,
This series is nothing but a clean-up patch series. I hope it's not a just code churns, but a good start to do something for lnvm.
The first one removed a redundant whitespace in the command description. The second one removed unnecessary print for the sizeof(dev) which will always be zero in case user does not give any argument for the device. The third patch removed temp variable instead casting the pinter directly. The last one just sync-up the kernel UAPI header file to the latest.
Please review.
Thanks,
Changes to V2:
- Resend the series with the latest patch commits.
Minwoo Im (4):
lnvm: remove redundant whitespace in lnvm_init()
lnvm: do not print 0 when the arg is not given
lnvm: cast identity structure to (void *) directly
lnvm: sync-up uapi lightnvm.h header from kernel
linux/lightnvm.h | 52 +++++++++++++++++++++++++++++++++++++++- nvme-lightnvm.c | 7 +++--- plugins/lnvm/lnvm-nvme.c | 8 +++---- 3 files changed, 58 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/4 lnvm: remove redundant whitespace in lnvm_init()
The description for lnvm-init subcommand has a redundant whitespace.
--- plugins/lnvm/lnvm-nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
plugins/lnvm/lnvm-nvme.c +1 -1
@@ -17,7 +17,7 @@static int lnvm_init (int argc,char **argv,struct command *cmd,struct plugin *plugin) {const char *desc ="Initialize LightNVM device. A LightNVM/Open-Channel SSD" \ -" must have a media manager associated before it can " \ +" must have a media manager associated before it can" \" be exposed to the user. The default is to initialize" " the general media manager on top of the device.\n\n" "Example:"
Signature · 1 line
2.17.1
PATCH 1/4 lnvm: remove redundant whitespace in lnvm_init()
Quoted 25 lines · Minwoo Im
The description for lnvm-init subcommand has a redundant whitespace.
Cc Keith Busch <kbusch at kernel.org>Cc Matias Bjorling <mb at lightnvm.io>Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>---
plugins/lnvm/lnvm-nvme.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)plugins/lnvm/lnvm-nvme.c +1
-2@@ -17,7 +17,7 @@static int lnvm_init (int argc,char **argv,struct command *cmd,struct plugin *plugin) {const char *desc ="Initialize LightNVM device. A LightNVM/Open-Channel SSD" \ -" must have a media manager associated before it can " \ +" must have a media manager associated before it can" \" be exposed to the user. The default is to initialize" " the general media manager on top of the device.\n\n" "Example:" --
Quoted 1 line
2.17.1
Looks good to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20190723/8a83905d/attachment.sig>
PATCH v2 2/4 lnvm: do not print 0 when the arg is not given
In reply to Minwoo ImIf an argument is not given by the user, it just needs to show the situation, not a prominent 0 which indicates the size of the argument variable.
--- plugins/lnvm/lnvm-nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
plugins/lnvm/lnvm-nvme.c +3 -3
@@ -48,7 +48,7 @@ static int lnvm_init(int argc, char **argv, struct command *cmd, struct plugin *return ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }
@@ -179,7 +179,7 @@ static int lnvm_create_tgt(int argc, char **argv, struct command *cmd, struct plreturn ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }if (!strlen (cfg.tgtname)) {
@@ -265,7 +265,7 @@ static int lnvm_factory_init(int argc, char **argv, struct command *cmd, structreturn ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }
Signature · 1 line
2.17.1
PATCH 2/4 lnvm: do not print 0 when the arg is not given
Quoted 45 lines · Minwoo Im
If an argument is not given by the user, it just needs to show the situation, not a prominent 0 which indicates the size of the argument variable.
Cc Keith Busch <kbusch at kernel.org>Cc Matias Bjorling <mb at lightnvm.io>Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>---
plugins/lnvm/lnvm-nvme.c| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)plugins/lnvm/lnvm-nvme.c +3
-4@@ -48,7 +48,7 @@ static int lnvm_init(int argc, char **argv, struct command *cmd, struct plugin *return ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }@@ -179,7 +179,7 @@ static int lnvm_create_tgt(int argc, char **argv, struct command *cmd, struct plreturn ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; }if (!strlen (cfg.tgtname)) {@@ -265,7 +265,7 @@ static int lnvm_factory_init(int argc, char **argv, struct command *cmd, structreturn ret;if (!strlen (cfg.devname)) { -fprintf (stderr,"device name missing %d\n" , (int )strlen (cfg.devname)); +fprintf (stderr,"device name missing\n" );return -EINVAL ; } --
Quoted 1 line
2.17.1
LGTM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20190723/ab5980fb/attachment.sig>
PATCH v2 3/4 lnvm: cast identity structure to (void *) directly
In reply to Minwoo ImIf we use "tmp" or something like this, we can expect that it just stores the previous pointer and do something else with the previous pointer. But, in this function, it just to cast it out.
--- nvme-lightnvm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
nvme-lightnvm.c +2 -3
@@ -422,13 +422,12 @@ static void show_lnvm_id20_ns(struct nvme_nvm_id20 *id, unsigned int flags)static void show_lnvm_id_ns (struct nvme_nvm_id *id,unsigned int flags) { -void *tmp = id;switch (id->ver_id) {case 1 : -show_lnvm_id12_ns (tmp, flags); +show_lnvm_id12_ns ((void *) id, flags);break ;case 2 : -show_lnvm_id20_ns (tmp, flags); +show_lnvm_id20_ns ((void *) id, flags);break ;default : fprintf(stderr, "Version %d not supported.\n",
Signature · 1 line
2.17.1
PATCH 3/4 lnvm: cast identity structure to (void *) directly
Quoted 34 lines · Minwoo Im
If we use "tmp" or something like this, we can expect that it just stores the previous pointer and do something else with the previous pointer. But, in this function, it just to cast it out.
Cc Keith Busch <kbusch at kernel.org>Cc Matias Bjorling <mb at lightnvm.io>Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>---
nvme-lightnvm.c| 5 ++---1 file changed, 2 insertions(+), 3 deletions(-)nvme-lightnvm.c +2
-4@@ -422,13 +422,12 @@ static void show_lnvm_id20_ns(struct nvme_nvm_id20 *id, unsigned int flags)static void show_lnvm_id_ns (struct nvme_nvm_id *id,unsigned int flags) { -void *tmp = id;switch (id->ver_id) {case 1 : -show_lnvm_id12_ns (tmp, flags); +show_lnvm_id12_ns ((void *) id, flags);break ;case 2 : -show_lnvm_id20_ns (tmp, flags); +show_lnvm_id20_ns ((void *) id, flags);break ;default : fprintf(stderr, "Version %d not supported.\n", --
Quoted 1 line
2.17.1
LGTM
Reviewed-by: Javier Gonz?lez <javier at javigon.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20190723/136ecac1/attachment.sig>
PATCH v2 4/4 lnvm: sync-up uapi lightnvm.h header from kernel
In reply to Minwoo ImThis patch just syncs-up UAPI header from the kernel. No functional changes included.
--- linux/lightnvm.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++- nvme-lightnvm.c | 2 +- 2 files changed, 52 insertions(+), 2 deletions(-)
linux/lightnvm.h +51 -1
@@ -77,7 +77,7 @@ struct nvm_ioctl_create_simple {struct nvm_ioctl_create_extended {__u16 lun_begin;__u16 lun_end; -__u16 over_prov; +__u16 op;__u16 rsv; };
@@ -135,6 +135,44 @@ struct nvm_ioctl_dev_factory {__u32 flags; }; +struct nvm_user_vio { +__u8 opcode; +__u8 flags; +__u16 control; +__u16 nppas; +__u16 rsvd; +__u64 metadata; +__u64 addr; +__u64 ppa_list; +__u32 metadata_len; +__u32 data_len; +__u64 status; +__u32 result; +__u32 rsvd3[3 ]; +}; + +struct nvm_passthru_vio { +__u8 opcode; +__u8 flags; +__u8 rsvd[2 ]; +__u32 nsid; +__u32 cdw2; +__u32 cdw3; +__u64 metadata; +__u64 addr; +__u32 metadata_len; +__u32 data_len; +__u64 ppa_list; +__u16 nppas; +__u16 control; +__u32 cdw13; +__u32 cdw14; +__u32 cdw15; +__u64 status; +__u32 result; +__u32 timeout_ms; +}; +/* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ enum {/* top level cmds */
@@ -150,6 +188,11 @@ enum {/* Factory reset device */ NVM_DEV_FACTORY_CMD , + +/* Vector user I/O */ +NVM_DEV_VIO_ADMIN_CMD =0x41 , +NVM_DEV_VIO_CMD =0x42 , + NVM_DEV_VIO_USER_CMD = 0x43, };#define NVM_IOCTL 'L'/* 0x4c */
@@ -167,6 +210,13 @@ enum {#define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, \ struct nvm_ioctl_dev_factory) +#define NVME_NVM_IOCTL_IO_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_USER_CMD, \ + struct nvm_passthru_vio) +#define NVME_NVM_IOCTL_ADMIN_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_ADMIN_CMD,\ + struct nvm_passthru_vio) +#define NVME_NVM_IOCTL_SUBMIT_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_CMD,\ + struct nvm_user_vio) +#define NVM_VERSION_MAJOR 1#define NVM_VERSION_MINOR 0#define NVM_VERSION_PATCHLEVEL 0
nvme-lightnvm.c +1 -1
@@ -167,7 +167,7 @@ int lnvm_do_create_tgt(char *devname, char *tgtname, char *tgttype, c.conf.type =NVM_CONFIG_TYPE_EXTENDED ; c.conf.e.lun_begin = lun_begin; c.conf.e.lun_end = lun_end; - c.conf.e.over_prov = over_prov; + c.conf.e.op = over_prov; }else { c.conf.type =NVM_CONFIG_TYPE_SIMPLE ; c.conf.s.lun_begin = lun_begin;
Signature · 1 line
2.17.1
PATCH 4/4 lnvm: sync-up uapi lightnvm.h header from kernel
Quoted 111 lines · Minwoo Im
This patch just syncs-up UAPI header from the kernel. No functional changes included.
Cc Keith Busch <kbusch at kernel.org>Cc Matias Bjorling <mb at lightnvm.io>Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>---
linux/lightnvm.h| 52 +++++++++++++++++++++++++++++++++++++++++++++++-nvme-lightnvm.c| 2 +-2 files changed, 52 insertions(+), 2 deletions(-)linux/lightnvm.h +51
-1@@ -77,7 +77,7 @@ struct nvm_ioctl_create_simple {struct nvm_ioctl_create_extended {__u16 lun_begin;__u16 lun_end; -__u16 over_prov; +__u16 op;__u16 rsv; };@@ -135,6 +135,44 @@ struct nvm_ioctl_dev_factory {__u32 flags; }; +struct nvm_user_vio { +__u8 opcode; +__u8 flags; +__u16 control; +__u16 nppas; +__u16 rsvd; +__u64 metadata; +__u64 addr; +__u64 ppa_list; +__u32 metadata_len; +__u32 data_len; +__u64 status; +__u32 result; +__u32 rsvd3[3 ]; +}; + +struct nvm_passthru_vio { +__u8 opcode; +__u8 flags; +__u8 rsvd[2 ]; +__u32 nsid; +__u32 cdw2; +__u32 cdw3; +__u64 metadata; +__u64 addr; +__u32 metadata_len; +__u32 data_len; +__u64 ppa_list; +__u16 nppas; +__u16 control; +__u32 cdw13; +__u32 cdw14; +__u32 cdw15; +__u64 status; +__u32 result; +__u32 timeout_ms; +}; +/* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ enum {/* top level cmds */ @@ -150,6 +188,11 @@ enum {/* Factory reset device */ NVM_DEV_FACTORY_CMD , + +/* Vector user I/O */ +NVM_DEV_VIO_ADMIN_CMD =0x41 , +NVM_DEV_VIO_CMD =0x42 , + NVM_DEV_VIO_USER_CMD = 0x43, };#define NVM_IOCTL 'L'/* 0x4c */ @@ -167,6 +210,13 @@ enum {#define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, \ struct nvm_ioctl_dev_factory) +#define NVME_NVM_IOCTL_IO_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_USER_CMD, \ + struct nvm_passthru_vio) +#define NVME_NVM_IOCTL_ADMIN_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_ADMIN_CMD,\ + struct nvm_passthru_vio) +#define NVME_NVM_IOCTL_SUBMIT_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_CMD,\ + struct nvm_user_vio) +#define NVM_VERSION_MAJOR 1#define NVM_VERSION_MINOR 0#define NVM_VERSION_PATCHLEVEL 0nvme-lightnvm.c +1
-2@@ -167,7 +167,7 @@ int lnvm_do_create_tgt(char *devname, char *tgtname, char *tgttype, c.conf.type =NVM_CONFIG_TYPE_EXTENDED ; c.conf.e.lun_begin = lun_begin; c.conf.e.lun_end = lun_end; - c.conf.e.over_prov = over_prov; + c.conf.e.op = over_prov; }else { c.conf.type =NVM_CONFIG_TYPE_SIMPLE ; c.conf.s.lun_begin = lun_begin; --
Quoted 1 line
2.17.1
LGTM
Reviewed-by: Javier Gonz?lez <javier at javigon.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20190723/39f97d8b/attachment.sig>
v2 cover lnvm: minor clean-ups
In reply to Minwoo ImQuoted 25 lines · Minwoo Im
Hi,
This series is nothing but a clean-up patch series. I hope it's not a just code churns, but a good start to do something for lnvm.
The first one removed a redundant whitespace in the command description. The second one removed unnecessary print for the sizeof(dev) which will always be zero in case user does not give any argument for the device. The third patch removed temp variable instead casting the pinter directly. The last one just sync-up the kernel UAPI header file to the latest.
Please review.
Thanks,
Changes to V2:
- Resend the series with the latest patch commits.Minwoo Im (4):
lnvm: remove redundant whitespace inlnvm_init()
lnvm: do not print 0 when the arg is not given
lnvm: cast identity structure to (void *) directly
lnvm: sync-up uapilightnvm.hheader from kernel
Quoted 5 lines
linux/lightnvm.h | 52 +++++++++++++++++++++++++++++++++++++++- nvme-lightnvm.c | 7 +++--- plugins/lnvm/lnvm-nvme.c | 8 +++---- 3 files changed, 58 insertions(+), 9 deletions(-)
Thanks Minwoo.
Patch 1-3 looks good to me. Keith, feel free to pick them up.
Patch 4 can wait until there is a use for the data structures.
Keith Busch
maintainerv2 cover lnvm: minor clean-ups
Quoted 32 lines · Matias Bj?rling
Quoted 25 lines · Minwoo Im
Hi,
This series is nothing but a clean-up patch series. I hope it's not a just code churns, but a good start to do something for lnvm.
The first one removed a redundant whitespace in the command description. The second one removed unnecessary print for the sizeof(dev) which will always be zero in case user does not give any argument for the device. The third patch removed temp variable instead casting the pinter directly. The last one just sync-up the kernel UAPI header file to the latest.
Please review.
Thanks,
Changes to V2:
- Resend the series with the latest patch commits.Minwoo Im (4):
lnvm: remove redundant whitespace inlnvm_init()
lnvm: do not print 0 when the arg is not given
lnvm: cast identity structure to (void *) directly
lnvm: sync-up uapilightnvm.hheader from kernelQuoted 5 lines
linux/lightnvm.h | 52 +++++++++++++++++++++++++++++++++++++++- nvme-lightnvm.c | 7 +++--- plugins/lnvm/lnvm-nvme.c | 8 +++---- 3 files changed, 58 insertions(+), 9 deletions(-)
Quoted 5 lines
Thanks Minwoo.
Patch 1-3 looks good to me. Keith, feel free to pick them up.
Patch 4 can wait until there is a use for the data structures.
Sounds good, series applied from the pull-request.