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: usizeHardware queues. blk-mq applies nr_requests to each one.
rotational: boolqueue/rotational is 1 when the queue file says so.
The flag is recorded. It does not select the read plan.
Implementations§
Source§impl QueueLimits
impl QueueLimits
Sourcepub fn page_default(page: usize) -> Self
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.
pub fn of(path: &Path) -> Result<Self, ParseError>
Sourcepub fn worker_span(&self, workers: usize) -> usize
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.