Skip to main content

IoSetupState

Struct IoSetupState 

Source
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: bool

Implementations§

Source§

impl IoSetupState

Source

pub fn with_shared_sqpoll(self) -> Result<Self>

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.

Source

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.

Source

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).

Source

pub fn shared_sqpoll_fd(&self) -> Option<BorrowedFd<'_>>

Trait Implementations§

Source§

impl Default for IoSetupState

Source§

fn default() -> IoSetupState

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.