Page MenuHomeFreeBSD

nvmf: Refactor nvmf_add_namespaces to be more generic
ClosedPublic

Authored by jhb on Sun, Jun 2, 6:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 5, 8:14 PM
Unknown Object (File)
Mon, Jun 3, 5:43 PM
Subscribers
None

Details

Summary

Rename to nvmf_scan_active_namespaces and accept an additional
callback function and callback argument. The callback is invoked on
each active namespace enumerated by the active namespace list from the
IDENTIFY command.

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Sun, Jun 2, 6:44 PM
jhb created this revision.

This is definitely better as it is. And I'm not 100% sure about the rescan stuff... it was my takeaway before I had to remove the 1 NVMe card I had that supported namespace management from my active system... I played around with several different combos, and I think I saw the repeat in a sloop of delete ns ; add ns... But that's been a couple of years.

sys/dev/nvmf/host/nvmf.c
299

part of me thinks this will eventually live in some .h file.

342

I think the fail-safe thing here is to tell the SIM to rescan the existing namespace. If nothing changed, there's no harm.

417

(eg, apropos of earlier comment):

I think this should instead just skip the nvmf_init_ns() below (or just call the rescan here. I recall messing around with this in nvmE land, and coming to the conclusion we needed it sometimes.

or maybe scan the active namespace and then call the sim thing.

This revision is now accepted and ready to land.Sun, Jun 2, 7:10 PM
sys/dev/nvmf/host/nvmf.c
417

This is only used during the initial walk of the active NS list during attach (post-attach rescans use a different callback that ignores an already-active ID). The assumption here is that it would be a bug to list an active namespace twice. Note that the namespace list is required to be sorted by ID as well. Generally speaking this is also acting on a snapshot of the list read from the controller, not something that can change while it is being iterated.