Skip to main content

readahead

Function readahead 

Source
pub fn readahead(
    fd: impl AsRawFd,
    offset: u64,
    len: usize,
) -> Result<(), CoreError>
Expand description

Advise the kernel to begin reading file data into the page cache.

This is an advisory hint only. It can help warm likely-needed file ranges, but the kernel may ignore the request, perform only part of it, or return before the data is fully resident in memory.

The offset and len identify the byte range to prefetch for fd. Success means the kernel accepted the request, not that subsequent reads are guaranteed to be cache hits. Advise the kernel to begin reading file data into the page cache.

ยงErrors

  • EBADF: The file descriptor is invalid.
  • EINVAL: The offset or length is invalid.