Expand description
VirtIO Block Device driver
Provides disk I/O via VirtIO-blk protocol for QEMU/KVM environments. Implements the BlockDevice trait for integration with filesystem layers.
Reference: VirtIO spec v1.2, Section 5.2 (Block Device)
Modulesยง
- features
- VirtIO block device features
Structsยง
- Block
Config ๐ - Block device configuration space
- Block
Request Header - VirtIO block request header
- Bounce
Pool ๐ - Pre-allocated DMA buffer used for all data transfers.
- Meta
Pool ๐ - Pre-allocated metadata frame: [Header (16 B)] + padding + [Status (1 B)]. Reused for every request : never alloc/freed per I/O.
- Virtio
Block Device - VirtIO Block Device driver
Enumsยง
- Block
Error - Block
Status - VirtIO block request status
- Request
Type - VirtIO block request types
Constantsยง
- BOUNCE_
POOL_ ๐SIZE - Size of the pre-allocated bounce buffer pool (64 KB = 128 sectors). Requests up to this size avoid per-I/O buddy allocator calls.
- SECTOR_
SIZE - Block device sector size
Staticsยง
- VIRTIO_
BLK_ ๐DONE - Atomic flag set by the IRQ handler to signal request completion.
- VIRTIO_
BLK_ ๐ERROR - Atomic flag set by the IRQ handler on error.
- VIRTIO_
BLK_ ๐WQ - WaitQueue used for IRQ-driven completion (see
handle_interrupt/do_request). - VIRTIO_
BLOCK_ ๐IRQ - VirtIO block IRQ line (will be set during init)
- VIRTIO_
BLOCK_ ๐PTR - Global VirtIO block device reference (leaked Box, never freed).
Traitsยง
- Block
Device - Block device trait (implemented by VirtIO-blk and AHCI drivers)
Functionsยง
- get_
device - Get the global VirtIO block device
- get_irq
- Get the VirtIO block IRQ line
- handle_
interrupt - Handle VirtIO block device interrupt
- init
- Initialize VirtIO block device