blob: 5c6bef7453d7586da4f83ac35695c957930b929d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
<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>
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
visibility: hidden;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
visibility: visible;
}
</style><a href="index.html">Index </a>·
<a href="systemd.directives.html">Directives </a>·
<a href="../python-systemd/index.html">Python </a>·
<a href="../libudev/index.html">libudev </a>·
<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
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.</p><p>The <em class="parameter"><code>action</code></em> should be one
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
data collection, and drops all
read-ahead data collected during this
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
data collection, but keeps all
read-ahead data collected during this
boot-up around for use during
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
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
errno-style error code. It is generally recommended to
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
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.</p><p>Internally, this function creates a file in
<code class="filename">/run/systemd/readahead/</code> which is
then used as flag file to notify the read-ahead
subsystem.</p><p>For details about the algorithm check the
liberally licensed reference implementation sources:
<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>
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
implemented in the reference implementation's drop-in
<code class="filename">sd-readahead.c</code> and
<code class="filename">sd-readahead.h</code> files. It is
recommended that applications consuming this API copy
the implementation into their source tree. For more
details about the reference implementation see
<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,
this function will always return 0 and otherwise
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
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.
</p><pre class="programlisting">sd_readahead("cancel");
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>
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
<a href="sd-readahead.html"><span class="citerefentry"><span class="refentrytitle">sd-readahead</span>(3)</span></a>,
<a href="daemon.html"><span class="citerefentry"><span class="refentrytitle">daemon</span>(7)</span></a>
</p></div></div></body></html>
|