pub struct IoSetupState {
pub use_direct_io: bool,
pub use_registered_io_uring_buffers: bool,
/* private fields */
}Expand description
State used by IO utilities for managing shared resources and configuration during setup.
This may include io_uring file descriptors, flag whether to register memory buffers in kernel, and other resources that need to be accessed by multiple functions performing IO operations such that they can efficiently cooperate with each other.
This is achieved by creating IoSetupState at the beginning of the processing setup and
passing its reference to IO utilities that need sharing / customized options.
Note: the state needs to live only during creation of the IO utilities, not during their usage, so it’s generally advisable to drop it after setup is done such that e.g. init-only squeue is released.
Fields§
§use_direct_io: bool§use_registered_io_uring_buffers: boolImplementations§
Source§impl IoSetupState
impl IoSetupState
Enables shared io-uring worker pool and sqpoll based kernel thread.
The sqpoll thread will drain submission queues from all io-uring instances created
through builder obtained from create_io_uring_builder() with FD obtained from
shared_sqpoll_fd() after this call.
Sourcepub fn with_buffers_registered(self, fixed: bool) -> Self
pub fn with_buffers_registered(self, fixed: bool) -> Self
Enables registering of buffers in io-uring (as fixed).
Speeds up kernel operations on the memory, but requires appropriate memlock ulimit.
Sourcepub fn with_direct_io(self, use_direct_io: bool) -> Self
pub fn with_direct_io(self, use_direct_io: bool) -> Self
Enables direct I/O for operations that bypass the operating system’s caching layer.
File system is required to support opening files with O_DIRECT flag.
This can improve performance when allocation and checking of caches by the kernel is slower than the overall savings from re-using cached file data (e.g. for read / write once data).