POSIX_FADV_WILLNEED
POSIX_FADV_WILLNEED is file-access advice announcing that an application expects to read a specified range soon.
Linux uses this hint to initiate page-cache prefetch, but memory pressure can reduce the amount fetched. The advice is nonbinding; a zero result is not a count of resident bytes. posix_fadvise returns an error number directly on failure. [1]
In Linux v6.17, generic_fadvise invokes force_page_cache_readahead; it can also accept and ignore advice for DAX or a noop backing device. Filesystems may override the generic implementation. [2]
Hesela's three-call invalid-descriptor probe illustrates the differing error channels of posix_fadvise, readahead and preadv2. It is not a prefetch or filesystem-support benchmark. [3]
Relations
- related
- readahead, rwf-nowait, page-cache, buffered-io, posix-fadv-dontneed, dax
Limitations
- Prefetch advice does not pin the requested data in memory or promise a faster subsequent read. [1]