Page MenuHomeFreeBSD

camcontrol: Add an nvformat subcommand to format NVMe devices
Needs ReviewPublic

Authored by ken on Wed, Sep 9, 3:34 PM.

Details

Reviewers
None
Group Reviewers
cam
Summary

Add NVMe Format NVM support to camcontrol(8):

camcontrol nvformat ndaX [-e <user|crypto|num>] [-G]
    [-f format] [-l pil] [-m mset] [-p pi]

This allows formatting an NVMe namespace (or, with -G, all
namespaces on the drive), changing the LBA format (sector size and
metadata size), configuring protection information, and secure
erase (user data or cryptographic).

The supported LBA formats and the current LBA format for a
namespace are visible in the NVMe namespace Identify data, via
camcontrol identify ndaX -N.

sbin/camcontrol/nvformat.c:

New file, the camcontrol(8) nvformat subcommand.

sbin/camcontrol/camcontrol.c:

Add the nvformat subcommand.

sbin/camcontrol/camcontrol.h:

Add the nvmeformat() prototype.

sbin/camcontrol/Makefile:

Add nvformat.c to the build.

sbin/camcontrol/camcontrol.8:

Document the nvformat subcommand.  Point readers of the
format (SCSI FORMAT UNIT) subcommand documentation at
nvformat for NVMe devices.

Sponsored by: Spectra Logic

Depends on D59534

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 76700
Build 73583: arc lint + arc unit

Event Timeline

ken requested review of this revision.Wed, Sep 9, 3:35 PM
sbin/camcontrol/camcontrol.c
240

What's NV?
This formats a namespace

Also, why not just format with a protocol selector like we do for identify, sanitize, etc.

sbin/camcontrol/nvformat.c
96

I'd be tempted to rename scsi_get_nv to something that doesn't have scsi in the name, since it's not a scsi thing at all anymore, with backwards compat symbols for a while.

252

I'm pretty sure the extra comments here aren't really helping