Page MenuHomeFreeBSD

nvmf: Refactor nvmf_add_namespaces to be more generic
ClosedPublic

Authored by jhb on Jun 2 2024, 6:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 3:47 PM
Unknown Object (File)
Fri, Nov 1, 6:12 AM
Unknown Object (File)
Sep 18 2024, 6:14 PM
Unknown Object (File)
Sep 18 2024, 12:36 PM
Unknown Object (File)
Sep 18 2024, 8:47 AM
Unknown Object (File)
Sep 17 2024, 3:22 PM
Unknown Object (File)
Sep 17 2024, 6:20 AM
Unknown Object (File)
Sep 15 2024, 10:34 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 58010
Build 54898: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Jun 2 2024, 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.Jun 2 2024, 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.