nvme-user: Minor enhancement and fixes
PATCH v2 1/1 nvme-user: Minor enhancement and fixes
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.html)
Minor enhancements to nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.
--- nvme_format_ns.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 7 deletions(-)
nvme_format_ns.c +73 -7
@@ -14,11 +14,12 @@ int main(int argc, char **argv) {static const char *perrstr;struct nvme_admin_cmd cmd; -int err, fd, nsid, fmt, i; +int err, fd, nsid, fmt, i, ms, ses; +struct nvme_id_ctrl ctrl;struct nvme_id_ns ns;if (argc <2 ) { -fprintf (stderr,"Usage: %s <device> [<lbaf>]\n" , +fprintf (stderr,"Usage: %s <device> [<lbaf>] [<ms>] [<ses>]\n" , argv[0 ]);return 1 ; }
@@ -28,6 +29,11 @@ int main(int argc, char **argv)if (fd <0 ) goto perror; + perrstr ="Identifying controller" ; + err =identify (fd,0 , &ctrl,1 ); +if (err <0 ) + goto perror; + perrstr ="Getting namespace ID" ; nsid =ioctl (fd,NVME_IOCTL_ID );if (nsid <0 )
@@ -38,7 +44,17 @@ int main(int argc, char **argv)if (err <0 ) goto perror; -if (argc ==2 ) { +if (argc ==5 ) { + fmt =atoi (argv[2 ]); + ms =atoi (argv[3 ]); + ses =atoi (argv[4 ]); + }else if (argc ==4 ) { + fmt =atoi (argv[2 ]); + ms =atoi (argv[3 ]); + }else if (argc ==3 ) { + fmt =atoi (argv[2 ]); + }else { +/* User Input for LBAF */ printf ("LBA formats:\n" );for (i =0 ; i <= ns.nlbaf; i++) { printf("lbaf %2d : ms:%-2d ds:%-2d rp:%#x %s\n", i,
@@ -51,20 +67,71 @@ int main(int argc, char **argv)printf ("Invalid input for format\n" );return -1 ; } - }else if (argc ==3 ) { - fmt =atoi (argv[2 ]); } +if (fmt <0 || fmt > ns.nlbaf) {printf ("Invalid format:%d\n" , fmt);return -1 ; } -printf ("Entered %d, formatting namespace\n" , fmt); + +if (argc <4 ) { +/* User Input for Metadata Settings */ +printf ("\nMetadata Settings(ms):\n" ); +printf ("Separate buffer 0 :\n" ); +printf ("Extended data LBA 1 :\n" ); +printf ("Enter ms: " ); + +if (scanf ("%d" , &ms) !=1 ) { +printf ("Invalid input for metadata settings\n" ); +return -1 ; + } + } + +if (ms <0 || ms >1 ) { +printf ("Invalid ms:%d\n" , ms); +return -1 ; + } + +if (argc <5 ) { +/* User Input for Secure Erase Settings */ +printf ("\nSecure Erase Settings(ses):\n" ); +printf ("No Secure Erase 0 :\n" ); +printf ("User Data Erase 1 :\n" ); +printf ("Cryptographic Erase 2 :\n" ); +printf ("Enter ses: " ); + +if (scanf ("%d" , &ses) !=1 ) { +printf ("Invalid input for secure erase settings\n" ); +return -1 ; + } + } + +if (ses <0 || ses >2 ) { +printf ("Invalid ses:%d\n" , ses); +return -1 ; + } + +if (ses ==2 ) { +/* Check if cryptographic erase is supported or not */ +if (!(ctrl.fna & (1 <<2 ))) { +printf ("Cryptographic Erase not supported\n" ); +return -1 ; + } + } + +printf ("\nEntered format index %d, ms %d, ses %d, formatting namespace\n" , fmt, ms, ses);memset (&cmd,0 ,sizeof (cmd)); cmd.opcode = nvme_admin_format_nvm; cmd.nsid = nsid; cmd.cdw10 = fmt; +/* Metadata Settings */ + cmd.cdw10 |= (ms <<4 ); + +/* Secure Erase Settings */ + cmd.cdw10 |= (ses <<9 ); + perrstr ="Format NVM" ; err =ioctl (fd,NVME_IOCTL_ADMIN_CMD , &cmd);if (err <0 )
@@ -78,4 +145,3 @@ int main(int argc, char **argv)perror (perrstr);return 1 ; } -
Signature · 1 line
1.8.3.2
Keith Busch
AppliedPATCH v2 1/1 nvme-user: Minor enhancement and fixes
Quoted 9 lines · Swati C
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.html)Minor enhancements to
nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.Signed-off-by Swati C <s.chawdhary at samsung.com>
Thanks, applied.
On a side note, some people asked if I could take the example programs here and turn it into something more useful with just one program to run all nvme instead of a bunch of stand-alone programs. I took a stab at it:
http://git.infradead.org/users/kbusch/linux-nvme-cli.git
It's still a work in progress, but just linking here in case others have ideas or find it useful too.
PATCH v2 1/1 nvme-user: Minor enhancement and fixes
Quoted 19 lines · Keith Busch
Quoted 10 lines · Swati C
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.html)Minor enhancements to
nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.Signed-off-by Swati C <s.chawdhary at samsung.com>Thanks, applied.
On a side note, some people asked if I could take the example programs here and turn it into something more useful with just one program to run all nvme instead of a bunch of stand-alone programs. I took a stab at it:
Quoted 4 lines
http://git.infradead.org/users/kbusch/linux-nvme-cli.git
It's still a work in progress, but just linking here in case others have ideas or find it useful too.
Thanks, I think something like this will be very helpful.
I noticed that FreeBSD already has an nvmecontrol command.
https://www.freebsd.org/cgi/man.cgi?query=nvmecontrol&sektion=8&apropos=0&manpath=FreeBSD+10.1-RELEASE
I haven't tried it or looked to see what the functional differences are between nvmecontrol and your nvme, if any. Have you?
Thanks,
-- ljk
Quoted 5 lines
_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH v2 1/1 nvme-user: Minor enhancement and fixes
Quoted 25 lines · Linda Knippers
Quoted 19 lines · Keith Busch
Quoted 10 lines · Swati C
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.html)Minor enhancements to
nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.Signed-off-by Swati C <s.chawdhary at samsung.com>Thanks, applied.
On a side note, some people asked if I could take the example programs here and turn it into something more useful with just one program to run all nvme instead of a bunch of stand-alone programs. I took a stab at it:
Quoted 4 lines
http://git.infradead.org/users/kbusch/linux-nvme-cli.git
It's still a work in progress, but just linking here in case others have ideas or find it useful too.
Quoted 7 lines
Thanks, I think something like this will be very helpful.
I noticed that FreeBSD already has an nvmecontrol command.
https://www.freebsd.org/cgi/man.cgi?query=nvmecontrol&sektion=8&apropos=0&manpath=FreeBSD+10.1-RELEASEI haven't tried it or looked to see what the functional differences are between nvmecontrol and your nvme, if any. Have you?
Thanks for the link! I had no idea that existed, though it looks like mine implements more of the command set. I'll ask Jim if he's still working on that. I'd like to see more unified NVMe tooling, so collaboration is better.
Quoted 3 lines
Thanks,
-- ljk
Zakaria Abushima (zabushima)
AppliedPATCH v2 1/1 nvme-user: Minor enhancement and fixes
In reply to Keith BuschHi Keith and Swati,
I have used my vendor specific tool to create namespace and managed to create it,
It doesn't appear in GUI as a file system where I can save things in but in /dev/ it lists nvme0 and nvme0n1
So I thought I might need to format it ? then I have used your tool nvme-format-ns and formatted the namespace ?
Nothing success and says icotl interrupted.
and then I thought that I might need to mount it ? I used linux built-in mount function as following:- mount /dev/nvme0n1
Since then the nvme0 and nvme0n1 disappeared and when I call lspci -v I noticed slight change, which is the " module driver in use nvme0" line has disappeared ? when it use to appear ?
Any idear or help
Thanks a in advance.
Zakaria.
-----Original Message-----
From: Linux-nvme [mailto:[email protected]] On Behalf Of Keith Busch
Sent: 01 December 2014 15:46
To: Swati C
Cc: linux-nvme at lists.infradead.org
Subject: Re: [PATCH v2] nvme-user: Minor enhancement and fixes
Quoted 10 lines · Swati C
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.
html)Minor enhancements to
nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.Signed-off-by Swati C <s.chawdhary at samsung.com>
Thanks, applied.
On a side note, some people asked if I could take the example programs here and turn it into something more useful with just one program to run all nvme instead of a bunch of stand-alone programs. I took a stab at it:
http://git.infradead.org/users/kbusch/linux-nvme-cli.git
It's still a work in progress, but just linking here in case others have ideas or find it useful too.
_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
James R. Bergsten
AppliedPATCH v2 1/1 nvme-user: Minor enhancement and fixes
Were it me, I'd start over. Power cycle, use the VS tool, then use whatever Linux-dist-standard GUI thingy you have to do a FILESYSTEM format and then a mount on /dev/nvme0n1. That ought to work.
Good luck.
Jim B.
-----Original Message-----
From: Linux-nvme [mailto:[email protected]] On Behalf Of Zakaria Abushima (zabushima)
Sent: Friday, December 5, 2014 8:41 AM
To: Keith Busch; Swati C
Cc: linux-nvme at lists.infradead.org
Subject: RE: [PATCH v2] nvme-user: Minor enhancement and fixes
Hi Keith and Swati,
I have used my vendor specific tool to create namespace and managed to create it,
It doesn't appear in GUI as a file system where I can save things in but in /dev/ it lists nvme0 and nvme0n1
So I thought I might need to format it ? then I have used your tool nvme-format-ns and formatted the namespace ?
Nothing success and says icotl interrupted.
and then I thought that I might need to mount it ? I used linux built-in mount function as following:- mount /dev/nvme0n1
Since then the nvme0 and nvme0n1 disappeared and when I call lspci -v I noticed slight change, which is the " module driver in use nvme0" line has disappeared ? when it use to appear ?
Any idear or help
Thanks a in advance.
Zakaria.
-----Original Message-----
From: Linux-nvme [mailto:[email protected]] On Behalf Of Keith Busch
Sent: 01 December 2014 15:46
To: Swati C
Cc: linux-nvme at lists.infradead.org
Subject: Re: [PATCH v2] nvme-user: Minor enhancement and fixes
Quoted 10 lines · Swati C
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.
html)Minor enhancements to
nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.Signed-off-by Swati C <s.chawdhary at samsung.com>
Thanks, applied.
On a side note, some people asked if I could take the example programs here and turn it into something more useful with just one program to run all nvme instead of a bunch of stand-alone programs. I took a stab at it:
http://git.infradead.org/users/kbusch/linux-nvme-cli.git
It's still a work in progress, but just linking here in case others have ideas or find it useful too.
_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH v2 1/1 nvme-user: Minor enhancement and fixes
In reply to Zakaria Abushima (zabushima)It appears you broke your device.
If you see /dev/nvme0n1, you can treat it like any block handle (like /dev/sda, for example). You shouldn't have to run an nvme format unless that's what you really want to do, but it doesn't sound necessary given your goal, and your device became unresponsive after.
After you fix your device, you can create a filesystem:
# mke2fs /dev/nvme0n1
Then mount:
# mount /dev/nvme0n1 /mnt
Adjust accordingly if you want a different filesystem or mount point.
Quoted 52 lines · Zakaria Abushima (zabushima)
Hi Keith and Swati,
I have used my vendor specific tool to create namespace and managed to create it,
It doesn't appear in GUI as a file system where I can save things in but in
/dev/it lists nvme0 and nvme0n1So I thought I might need to format it ? then I have used your tool nvme-format-ns and formatted the namespace ?
Nothing success and says icotl interrupted.
and then I thought that I might need to mount it ? I used linux built-in mount function as following:- mount
/dev/nvme0n1Since then the nvme0 and nvme0n1 disappeared and when I call lspci -v I noticed slight change, which is the " module driver in use nvme0" line has disappeared ? when it use to appear ?
Any idear or help
Thanks a in advance.
Zakaria.
-----Original Message-----
From: Linux-nvme [mailto:linux-nvme-bounces at lists.infradead.org] On Behalf Of Keith Busch
Sent: 01 December 2014 15:46
To: Swati C
Cc: linux-nvme at lists.infradead.org
Subject: Re: [PATCH v2] nvme-user: Minor enhancement and fixesQuoted 10 lines · Swati C
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.
html)Minor enhancements to
nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.Signed-off-by Swati C <s.chawdhary at samsung.com>Thanks, applied.
On a side note, some people asked if I could take the example programs here and turn it into something more useful with just one program to run all nvme instead of a bunch of stand-alone programs. I took a stab at it:
http://git.infradead.org/users/kbusch/linux-nvme-cli.git
It's still a work in progress, but just linking here in case others have ideas or find it useful too.
_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH v2 1/1 nvme-user: Minor enhancement and fixes
Hi Keith,
I managed it to work by doing power cycle,
Also I followed mounting instruction and it worked but wondered how can I unmount it ? to be at previous state ?
Also I wondered why when I double click on the file system it says ? Not Authorized ?
Thanks
Zakaria.
-----Original Message-----
From: Keith Busch [mailto:[email protected]]
Sent: 05 December 2014 16:58
To: Zakaria Abushima (zabushima)
Cc: Keith Busch; Swati C; linux-nvme at lists.infradead.org
Subject: RE: [PATCH v2] nvme-user: Minor enhancement and fixes
It appears you broke your device.
If you see /dev/nvme0n1, you can treat it like any block handle (like /dev/sda, for example). You shouldn't have to run an nvme format unless that's what you really want to do, but it doesn't sound necessary given your goal, and your device became unresponsive after.
After you fix your device, you can create a filesystem:
# mke2fs /dev/nvme0n1
Then mount:
# mount /dev/nvme0n1 /mnt
Adjust accordingly if you want a different filesystem or mount point.
Quoted 56 lines · Zakaria Abushima (zabushima)
Hi Keith and Swati,
I have used my vendor specific tool to create namespace and managed to create it,
It doesn't appear in GUI as a file system where I can save things in but in
/dev/it lists nvme0 and nvme0n1So I thought I might need to format it ? then I have used your tool nvme-format-ns and formatted the namespace ?
Nothing success and says icotl interrupted.
and then I thought that I might need to mount it ? I used linux built-in mount function as following:- mount
/dev/nvme0n1Since then the nvme0 and nvme0n1 disappeared and when I call lspci -v I noticed slight change, which is the " module driver in use nvme0" line has disappeared ? when it use to appear ?
Any idear or help
Thanks a in advance.
Zakaria.
-----Original Message-----
From: Linux-nvme [mailto:linux-nvme-bounces at lists.infradead.org] On Behalf Of Keith Busch
Sent: 01 December 2014 15:46
To: Swati C
Cc: linux-nvme at lists.infradead.org
Subject: Re: [PATCH v2] nvme-user: Minor enhancement and fixesQuoted 10 lines · Swati C
Addressing comments from -
[PATCH] nvme-user: Minor enhancement and fixes
(http://lists.infradead.org/pipermail/linux-nvme/2014-November/001214.
html)Minor enhancements to
nvme_format_ns.c
- Make Metadata Settings a user settable value.
- Support for Secure Erase Settings.Signed-off-by Swati C <s.chawdhary at samsung.com>Thanks, applied.
On a side note, some people asked if I could take the example programs here and turn it into something more useful with just one program to run all nvme instead of a bunch of stand-alone programs. I took a stab at it:
http://git.infradead.org/users/kbusch/linux-nvme-cli.git
It's still a work in progress, but just linking here in case others have ideas or find it useful too.
_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme