Skip to main content

QueueLimits

Struct QueueLimits 

Source
pub struct QueueLimits {
    pub page: usize,
    pub logical_block: usize,
    pub max_request: usize,
    pub nr_requests: usize,
    pub read_ahead: usize,
    pub nr_hw_queues: usize,
    pub rotational: bool,
}
Expand description

Limits read from the block queue that holds path.

max_request is max_sectors_kb times 1024, the largest request that queue accepts (https://docs.kernel.org/admin-guide/abi-stable.html#abi-sys-block-disk-queue-max-sectors-kb). nr_requests is how many requests the queue can hold (https://docs.kernel.org/admin-guide/abi-stable.html#abi-sys-block-disk-queue-nr-requests). read_ahead is read_ahead_kb times 1024, the kernel readahead window. A partition is walked to its parent disk, which is the sysfs node that holds queue/. A missing queue file yields the page size, the unit madvise accepts, and a missing nr_requests yields 1. rotational is recorded and does not select the plan.

Fields§

§page: usize§logical_block: usize§max_request: usize§nr_requests: usize§read_ahead: usize§nr_hw_queues: usize

Hardware queues. blk-mq applies nr_requests to each one.

§rotational: bool

queue/rotational is 1 when the queue file says so. The flag is recorded. It does not select the read plan.

Implementations§

Source§

impl QueueLimits

Source

pub fn page_default(page: usize) -> Self

Page-sized stand-in used when the file has no block queue.

btrfs, tmpfs, overlayfs and NFS have no queue/ directory. The page is the unit madvise accepts, so one request of one page is the stand-in.

Source

pub fn of(path: &Path) -> Result<Self, ParseError>

Source

pub fn worker_span(&self, workers: usize) -> usize

Bytes one worker submits while the others share the same queue.

The queue holds nr_requests requests of max_request bytes. workers share it, so each gets nr_requests / workers requests, or one request when the queue is shorter than the worker count. The span is at least the kernel readahead window, because a shorter hint still pulls that window, and it is aligned down to the page.

Trait Implementations§

Source§

impl Clone for QueueLimits

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for QueueLimits

Source§

impl Debug for QueueLimits

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, !>

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.