sd_readahead (3) - Linux Man Pages
sd_readahead: Control ongoing disk boot-time read-ahead operations
sd_readahead - Control ongoing disk boot-time read-ahead operations
int sd_readahead(const char
The action should be one of the following strings:
- Terminates read-ahead data collection, and drops all read-ahead data collected during this boot-up.
- Terminates read-ahead data collection, but keeps all read-ahead data collected during this boot-up around for use during subsequent boot-ups.
- Terminates read-ahead replay.
This function is provided by the reference implementation of APIs for controlling boot-time read-ahead and distributed with the systemd package. The algorithm it implements is simple, and can easily be reimplemented in daemons if it is important to support this interface without using the reference implementation.
Internally, this function creates a file in /run/systemd/readahead/ which is then used as flag file to notify the read-ahead subsystem.
For details about the algorithm check the liberally licensed reference implementation sources: m[blue]http://cgit.freedesktop.org/systemd/systemd/plain/src/readahead/sd-readahead.cm and m[blue]http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-readahead.hm
sd_readahead() is implemented in the reference implementation's drop-in sd-readahead.c and sd-readahead.h files. It is recommended that applications consuming this API copy the implementation into their source tree. For more details about the reference implementation, see sd-readahead(3)
Example 1. Cancelling all read-ahead operations
During boots where SELinux has to relabel the file system hierarchy, it will create a large amount of disk accesses that are not necessary during normal boots. Hence it is a good idea to disable both read-ahead replay and read-ahead collection.