'\" t .\" Title: sd_readahead .\" Author: Lennart Poettering .\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: 10/07/2013 .\" Manual: sd_readahead .\" Source: systemd .\" Language: English .\" .TH "SD_READAHEAD" "3" "10/07/2013" "systemd" "sd_readahead" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" sd_readahead \- Control ongoing disk boot\-time read\-ahead operations .SH "SYNOPSIS" .sp .ft B .nf #include "sd\-readahead\&.h" .fi .ft .HP \w'int\ sd_readahead('u .BI "int sd_readahead(const\ char\ *" "action" ");" .SH "DESCRIPTION" .PP \fBsd_readahead()\fR may be called by programs involved with early boot\-up to control ongoing boot\-time disk read\-ahead operations\&. It may be used to terminate read\-ahead operations in case an uncommon disk access pattern is to be expected and hence read\-ahead replay or collection is unlikely to have the desired speed\-up effect on the current or future boot\-ups\&. .PP The \fIaction\fR should be one of the following strings: .PP cancel .RS 4 Terminates read\-ahead data collection, and drops all read\-ahead data collected during this boot\-up\&. .RE .PP done .RS 4 Terminates read\-ahead data collection, but keeps all read\-ahead data collected during this boot\-up around for use during subsequent boot\-ups\&. .RE .PP noreplay .RS 4 Terminates read\-ahead replay\&. .RE .SH "RETURN VALUE" .PP On failure, these calls return a negative errno\-style error code\&. It is generally recommended to ignore the return value of this call\&. .SH "NOTES" .PP 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\&. .PP Internally, this function creates a file in /run/systemd/readahead/ which is then used as flag file to notify the read\-ahead subsystem\&. .PP For details about the algorithm check the liberally licensed reference implementation sources: \m[blue]\fB\%http://cgit.freedesktop.org/systemd/systemd/plain/src/readahead/sd-readahead.c\fR\m[] resp\&. \m[blue]\fB\%http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-readahead.h\fR\m[] .PP \fBsd_readahead()\fR is implemented in the reference implementation\*(Aqs 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 \fBsd-readahead\fR(7) .PP If \-DDISABLE_SYSTEMD is set during compilation this function will always return 0 and otherwise become a NOP\&. .SH "EXAMPLES" .PP \fBExample\ \&1.\ \&Cancelling all read-ahead operations\fR .PP 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\&. .sp .if n \{\ .RS 4 .\} .nf sd_readahead("cancel"); sd_readahead("noreplay"); .fi .if n \{\ .RE .\} .SH "SEE ALSO" .PP \fBsystemd\fR(1), \fBsd-readahead\fR(7), \fBdaemon\fR(7) .SH "AUTHOR" .PP \fBLennart Poettering\fR <\&lennart@poettering\&.net\&> .RS 4 Developer .RE