Add Format NVM support to nvmecontrol
Needs ReviewPublic

Authored by chuck_tuffli.net on Jul 1 2017, 12:10 AM.

Details

Reviewers
None
Group Reviewers
manpages
Summary

This gives the ability to do a low level format of a pre-existing NVMe Namespace. The Format NVM command allows setting the block size of the Namespace (e.g. 512B or 4KB), specifying the type of T10 Protection Information to use, or erasing the contents. Note that similar options exist when creating a Namespace via the Namespace Management command.

The command options allow directly specifying all 5 parameters given in the NVMe 1.3 spec.

Test Plan

Formatted a drive with different LBAF values and observed that the output from nvmecontrol identify updated appropriately.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
imp added a comment.Jul 1 2017, 7:30 PM

Is this really format, or is it namespace provisioning? There's another set of name space provisioning patches that are also under review right now.

chuck_tuffli.net edited the summary of this revision. (Show Details)Jul 1 2017, 8:57 PM
In D11433#236562, @imp wrote:

Is this really format, or is it namespace provisioning? There's another set of name space provisioning patches that are also under review right now.

Yes, this is actually Format NVM and not Namespace Management.

wblock added a subscriber: wblock.Jul 7 2017, 4:04 PM
wblock added inline comments.
sbin/nvmecontrol/nvmecontrol.8
36

Please remember to bump .Dd.

138

Please start new sentences on new lines.

This section would be easier to read as a list (.Bl):

.Ss format
The format command allows a low level format of the NVM media.
Each of the options mirror the field names defined in the NVM Express
specification.
.Bl -tag -width 10n
.It Fl f
Choose the LBA Format.
Valid values are 0-15.
.It Fl m
Choose whether metadata is appended to the block (extended LBA) or sent
in a separate buffer.
.It Fl p
Select the end-to-end protection information (Type 0 - 3).
.It Fl l
Select whether the protection information is first (1) or last (0) in the
metadata.
.It Fl s
Select the type of low level format (none = 0, user erase = 1,
cryptographic erase = 2).
imp added a comment.Jul 7 2017, 4:12 PM

While complete, this interface is a total PITA. End to end protection type 2 is what again? Oh, I have to go look in the standard to understand all these parameters?
Can we at least have a description of what's going on here? A table for each of the magic numbers?

In D11433#238350, @imp wrote:

While complete, this interface is a total PITA. End to end protection type 2 is what again? Oh, I have to go look in the standard to understand all these parameters?
Can we at least have a description of what's going on here? A table for each of the magic numbers?

I'm not attached to this interface, and if it is going to be a pain to use, I'm happy to change it. Admittedly, the approach does require knowledge of the NVMe command. The thought was, by using raw values, the application doesn't need to change if the specification introduces a new parameter value.

Can you give me or point me to an example that would be a better model? Would the following be any better:
-b <block size in bytes>
-m <metadata size in bytes - default=0x0>
-s <option to specify separate metadata - default is extended LBA>
-p <T10 protection type - default is none, doc will have a description of each>
-l <option to specify protection information is first - default is location is last>
-e <option to do user data erase>
-E <option to do secure data erase>