POSIX_FADV_RANDOM
POSIX_FADV_RANDOM is a file-access hint indicating that an application expects to access the specified data in random order.
Linux applies this policy through the advised handle across the file, not only within the supplied byte range. Advice is nonbinding; a successful call does not report fetched bytes. [1]
In Linux v6.14 generic_fadvise, RANDOM sets FMODE_RANDOM without changing the saved readahead budget or FMODE_NOREUSE. WILLNEED remains a separate explicit prefetch path. Filesystem-specific handlers and DAX/noop cases can differ. [2]
The implementation stores policy on struct file. Duplicated descriptors share this open file description; independently opening the same file creates separate policy state, not a separate file cache. [2] [3]
Relations
- related
- POSIX_FADV_SEQUENTIAL, POSIX_FADV_NOREUSE, POSIX_FADV_WILLNEED, readahead (Linux syscall), Open file description, Page cache
Advantages
- Expresses a random-access expectation without requiring direct I/O.
Limitations
- Does not evict cached data, establish durability or forbid explicit prefetch.
Citations
- Linux man-pages: posix_fadvise(2), advice and Linux whole-file scope.
- Linux v6.14 mm/fadvise.c: generic_fadvise policy transitions and overrides.
- Linux man-pages: open(2), open file descriptions and duplicated descriptors.
Sources & caveats
- Source review of Linux v6.14 generic advice behavior; not a native experiment or benchmark.