]> git.proxmox.com Git - systemd.git/blob - man/sd_readahead.html
Imported Upstream version 208
[systemd.git] / man / sd_readahead.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_readahead</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 208</span><hr><div class="refentry"><a name="sd_readahead"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_readahead — Control ongoing disk boot-time read-ahead operations</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include "sd-readahead.h"</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_readahead</b>(</code></td><td>const char *<var class="pdparam">action</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm274682558800"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p><code class="function">sd_readahead()</code> may be
23 called by programs involved with early boot-up to
24 control ongoing boot-time disk read-ahead operations. It may be
25 used to terminate read-ahead operations in case an
26 uncommon disk access pattern is to be expected and
27 hence read-ahead replay or collection is unlikely to
28 have the desired speed-up effect on the current or
29 future boot-ups.</p><p>The <em class="parameter"><code>action</code></em> should be one
30 of the following strings:</p><div class="variablelist"><dl class="variablelist"><dt id="cancel"><span class="term">cancel</span><a class="headerlink" title="Permalink to this term" href="#cancel"></a></dt><dd><p>Terminates read-ahead
31 data collection, and drops all
32 read-ahead data collected during this
33 boot-up.</p></dd><dt id="done"><span class="term">done</span><a class="headerlink" title="Permalink to this term" href="#done"></a></dt><dd><p>Terminates read-ahead
34 data collection, but keeps all
35 read-ahead data collected during this
36 boot-up around for use during
37 subsequent boot-ups.</p></dd><dt id="noreplay"><span class="term">noreplay</span><a class="headerlink" title="Permalink to this term" href="#noreplay"></a></dt><dd><p>Terminates read-ahead
38 replay.</p></dd></dl></div></div><div class="refsect1"><a name="idm274682550656"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value"></a></h2><p>On failure, these calls return a negative
39 errno-style error code. It is generally recommended to
40 ignore the return value of this call.</p></div><div class="refsect1"><a name="idm274682549296"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes"></a></h2><p>This function is provided by the reference
41 implementation of APIs for controlling boot-time
42 read-ahead and distributed with the systemd
43 package. The algorithm it implements is simple, and
44 can easily be reimplemented in daemons if it is
45 important to support this interface without using the
46 reference implementation.</p><p>Internally, this function creates a file in
47 <code class="filename">/run/systemd/readahead/</code> which is
48 then used as flag file to notify the read-ahead
49 subsystem.</p><p>For details about the algorithm check the
50 liberally licensed reference implementation sources:
51 <a class="ulink" href="http://cgit.freedesktop.org/systemd/systemd/plain/src/readahead/sd-readahead.c" target="_top">http://cgit.freedesktop.org/systemd/systemd/plain/src/readahead/sd-readahead.c</a>
52 and <a class="ulink" href="http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-readahead.h" target="_top">http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-readahead.h</a></p><p><code class="function">sd_readahead()</code> is
53 implemented in the reference implementation's drop-in
54 <code class="filename">sd-readahead.c</code> and
55 <code class="filename">sd-readahead.h</code> files. It is
56 recommended that applications consuming this API copy
57 the implementation into their source tree. For more
58 details about the reference implementation see
59 <a href="sd-readahead.html"><span class="citerefentry"><span class="refentrytitle">sd-readahead</span>(3)</span></a></p><p>If -DDISABLE_SYSTEMD is set during compilation,
60 this function will always return 0 and otherwise
61 become a NOP.</p></div><div class="refsect1"><a name="idm274686496128"></a><h2 id="Examples">Examples<a class="headerlink" title="Permalink to this headline" href="#Examples"></a></h2><div class="example"><a name="idm274686495456"></a><p class="title"><b>Example 1. Cancelling all read-ahead operations</b></p><div class="example-contents"><p>During boots where SELinux has to
62 relabel the file system hierarchy, it will
63 create a large amount of disk accesses that
64 are not necessary during normal boots. Hence
65 it is a good idea to disable both read-ahead replay and read-ahead collection.
66 </p><pre class="programlisting">sd_readahead("cancel");
67 sd_readahead("noreplay");</pre></div></div><br class="example-break"></div><div class="refsect1"><a name="idm274686493088"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
68 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
69 <a href="sd-readahead.html"><span class="citerefentry"><span class="refentrytitle">sd-readahead</span>(3)</span></a>,
70 <a href="daemon.html"><span class="citerefentry"><span class="refentrytitle">daemon</span>(7)</span></a>
71 </p></div></div></body></html>