Skip to main content

base_scheduler/
advice_mode.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4/// A file access or cache-management hint. Advice does not change the file's contents, size, or cursor, and the operating system may ignore it.
5#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
6pub enum AdviceMode {
7    /// Restore the default access policy.
8    #[default]
9    Normal,
10    /// Expect sequential access; the OS may increase readahead.
11    Sequential,
12    /// Expect random access; the OS may disable readahead.
13    Random,
14    /// Hint that the range will be accessed soon. Completion does not guarantee that it is resident in memory.
15    WillNeed,
16    /// Hint that cached pages in the range are no longer needed. This does not guarantee eviction or write dirty pages durably; partial pages may be ignored.
17    DontNeed,
18    /// Hint that the range is unlikely to be reused. The effect depends on the OS and kernel version.
19    NoReuse,
20}