Skip to main content

Module storage_io

Module storage_io 

Source
Expand description

Platform-abstracted non-blocking storage I/O for Ring 0.

§Storage I/O Abstraction

Platform-abstracted non-blocking storage I/O for the thread-per-core architecture.

§Design

Ring 0 cannot block, allocate, or syscall on the hot path. Storage I/O needs a submission-completion model that fits the synchronous spin-loop:

  1. Submit: push a write or sync request (non-blocking)
  2. Poll: check for completions on the next loop iteration

Two backends implement this interface:

  • SyncStorageIo — executes I/O inline via std::fs. Write “completes” when data is in the kernel page cache. Sync “completes” after fdatasync. Works on all platforms. This is the default.

  • UringStorageIo (Linux + io-uring feature) — submits SQEs to a per-core ring. With SQPOLL, submissions are zero-syscall. Completions arrive via CQE polling.

§Usage from Ring 0

// Cold path (init_core_thread):
let storage = SyncStorageIo::new();
let wal_fd = storage.register_fd(file);

// Hot path (core_thread_main loop):
storage.submit_write(fd, &data, offset)?;
storage.flush()?;
// ... next iteration ...
completions.clear();
storage.poll_completions(&mut completions);

Structs§

IoCompletion
Completion of a submitted I/O operation.
IoFd
Opaque file descriptor managed by a StorageIo backend.
SyncStorageIo
Synchronous storage I/O backend.
UringStorageIo
io_uring storage I/O backend.

Enums§

StorageIoError
Errors from the storage I/O layer.

Traits§

StorageIo
Non-blocking storage I/O backend for Ring 0.