Page MenuHomeFreeBSD

camcontrol: Add an nvres subcommand for NVMe reservations
Needs ReviewPublic

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

Details

Reviewers
None
Group Reviewers
cam
Summary

Add NVMe reservation support to camcontrol(8). This supports the
four NVMe reservation opcodes: Report, Register, Acquire and
Release, in the same way that the camcontrol persist subcommand
supports SCSI Persistent Reservations:

camcontrol nvres ndaX -a report [-e]
camcontrol nvres ndaX -a register -A <register|unregister|replace>
    [-i] [-k curkey] [-K newkey] [-p <enable|disable>]
camcontrol nvres ndaX -a acquire -A <acquire|preempt|preempt_abort>
    -k curkey [-K prekey] -T resv_type
camcontrol nvres ndaX -a release -A <clear|release> -k curkey
    -T resv_type

The report action displays the reservation status and registered
controllers for a namespace, including the full 8 or 16 byte hostid
for each registrant depending on the value of the eds (extended
data structure) bit.

sbin/camcontrol/nvres.c:

New file, NVMe reservation support.

sbin/camcontrol/camcontrol.c:

Add the nvres subcommand.

sbin/camcontrol/camcontrol.h:

Add the nvmeres() prototype.

sbin/camcontrol/Makefile:

Add nvres.c to the build.

sbin/camcontrol/camcontrol.8:

Document the nvres subcommand.

Co-authored-by: Reid Linnemann <reidl@spectralogic.com>
Sponsored by: Spectra Logic

Depends on D59532
Depends on D59533

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 76699
Build 73582: arc lint + arc unit

Event Timeline

I'd have also broken this up by subcommand because all together the review length is starting to get hard to review.
And it's unclear what the actual syntax here is too. It's a case where the old-school camcontrol commands are getting in the way of having commands that are more similar to linux's nvme cli. Translating between what we do and what they do is a lot of friction for no benefit.

sbin/camcontrol/camcontrol.8
371

why nvres? Why not just reserve? nv is weird to people that are used to other commands.
nvme cli doesn't have any prefixes and has these as separate commands, for example. It prefixes all of them with resv, which is available in camcontrol