How snu-csl/nvmevirt works
NVMeVirt is a Linux kernel module that emulates a PCI-attached NVMe device, supporting conventional SSD, NVM, ZNS, and key-value device configurations. The main workflow is an NVMe host submitting commands to the virtual controller; admin commands configure queues and expose device information, while I/O commands are dispatched to the selected storage model and completed through the queues. The README documents the supported device types; unsampled source means some internal dispatch wiring is not shown here.
Main entry points: io.c I/O dispatch · zns_ftl.c ZNS FTL · pci.c PCI device · ssd.c SSD model
Components 17
Virtual controller
- PCI device
pci.c - Module runtime
main.c - Admin commands
admin.c
Request processing
- I/O dispatch
io.c - DMA transfer
dma.c
Storage backends
- Conventional FTL
conv_ftl.c - Simple FTL
simple_ftl.c - Key-value FTL
kv_ftl.c - ZNS FTL
zns_ftl.c - ZNS reads/writes
zns_read_write.c - Zone management
zns_mgmt_send.c - Zone reports
zns_mgmt_recv.c - Append handling
append_only.c
Device modeling
- Reserved storage
main.c - SSD model
ssd.c - Channel timing
channel_model.c
Other components
- NVMe host
Connections 18
- NVMe host → PCI device: submits commands
- Module runtime → PCI device: initializes device
- PCI device → Admin commands: dispatches admin
- PCI device → I/O dispatch: dispatches I/O
- I/O dispatch → DMA transfer: transfers data
- I/O dispatch → Conventional FTL: processes I/O
- I/O dispatch → Simple FTL: processes I/O
- I/O dispatch → Key-value FTL: processes I/O
- I/O dispatch → ZNS FTL: processes I/O
- ZNS FTL → ZNS reads/writes: handles reads/writes
- ZNS FTL → Zone management: handles management
- ZNS FTL → Zone reports: handles reports
- Conventional FTL → SSD model: models flash
- ZNS reads/writes → SSD model: models flash
- SSD model → Channel timing: models timing
- Simple FTL → Reserved storage: accesses data
- Key-value FTL → Reserved storage: stores values
- Append handling → Reserved storage: appends data