1CACHEFILESD.CONF(5) Cache Files Utilities CACHEFILESD.CONF(5)
2
3
4
6 /etc/cachefilesd.conf - Local file caching configuration file
7
9 The configuration file for cachefilesd which can manage a persistent
10 cache for a variety of network filesystems using a set of files on an
11 already mounted filesystem as the data store.
12
14 This configuration file can contain a number of commands. Each one
15 should be on a separate line. Blank lines and lines beginning with a
16 '#' character are considered to be comments and are discarded.
17
18 The only mandatory command is:
19
20 dir <path>
21 This command specifies the directory containing the root of the
22 cache. It may only specified once per configuration file.
23
24 All the other commands are optional:
25
26 secctx <label>
27 Specify an LSM security context as which the kernel will perform
28 operations to access the cache. The default is to use
29 cachefilesd's security context. Files will be created in the
30 cache with the label of directory specified to the 'dir' com‐
31 mand.
32
33 brun <N>%
34
35 bcull <N>%
36
37 bstop <N>%
38
39 frun <N>%
40
41 fcull <N>%
42
43 fstop <N>%
44 These commands configure the culling limits. The defaults are
45 7% (run), 5% (cull) and 1% (stop) respectively. See the section
46 on cache culling for more information.
47
48 The commands beginning with a 'b' are file space (block) limits,
49 those beginning with an 'f' are file count limits.
50
51 tag <name>
52 This command specifies a tag to FS-Cache to use in distinguish‐
53 ing multiple caches. This is only required if more than one
54 cache is going to be used. The default is "CacheFiles".
55
56 culltable <log2size>
57 This command specifies the size of the tables holding the lists
58 of cullable objects in the cache. The bigger the number, the
59 faster and more smoothly that culling can proceed when there are
60 many objects in the cache, but the more memory will be consumed
61 by cachefilesd.
62
63 The quantity is specified as log2 of the size actually required,
64 for example 12 indicates a table of 4096 entries and 13 indi‐
65 cates 8192 entries. The permissible values are between 12 and
66 20, the latter indicating 1048576 entries. The default is 12.
67
68 nocull Disable culling. Culling and building up the cull table take up
69 a certain amount of a systems resources, which may be undesir‐
70 able. Supplying this option disables all culling activity. The
71 cache will keep building up to the limits set and won't be
72 shrunk, except by the removal of out-dated cache files.
73
74 resume_thresholds <blocks> <files>
75 This command specifies the amount of blocks or files that the
76 kernel should let go of before the daemon should resume from
77 culling table scan suspension.
78
79 Scanning to refill the cull table is suspended when all the
80 objects in a cache are pinned by a live network filesystem in
81 the kernel and there's nothing to cull.
82
83 Either value can be "-" to indicate that this threshold should
84 be ignored.
85
86 debug <mask>
87 This command specifies a numeric bitmask to control debugging in
88 the kernel module. The default is zero (all off). The follow‐
89 ing values can be OR'd into the mask to collect various informa‐
90 tion:
91
92 1 Turn on trace of function entry (_enter() macros)
93
94 2 Turn on trace of function exit (_leave() macros)
95
96 4 Turn on trace of internal debug points (_debug())
97
98 This mask can also be set through /sys/module/cachefiles/parame‐
99 ters/debug.
100
102 As an example, consider the following:
103
104 dir /var/cache/fscache
105 secctx cachefiles_kernel_t
106 tag mycache
107 brun 10%
108 bcull 7%
109 bstop 3%
110 secctx system_u:system_r:cachefiles_kernel_t:s0
111
112 This places the cache storage objects in a directory called
113 "/var/cache/fscache", names the cache "mycache", permits the cache to
114 run freely as long as there's at least 10% free space on
115 /var/cache/fscache/, starts culling the cache when the free space drops
116 below 7% and stops writing new stuff into the cache if the amount of
117 free space drops below 3%. If the cache is suspended, it won't reacti‐
118 vate until the amount of free space rises again to 10% or better.
119
120 Furthermore, this will tell the kernel module the security context it
121 should use when accessing the cache (SELinux is assumed to be the LSM
122 in this example). In this case, SELinux would use cachefiles_kernel_t
123 as the key into the policy.
124
126 The cache may need culling occasionally to make space. This involves
127 discarding objects from the cache that have been used less recently
128 than anything else. Culling is based on the access time of data
129 objects. Empty directories are culled if not in use.
130
131 Cache culling is done on the basis of the percentage of blocks and the
132 percentage of files available in the underlying filesystem. There are
133 six "limits":
134
135 brun
136
137 frun If the amount of free space and the number of available files in
138 the cache rises above both these limits, then culling is turned
139 off.
140
141 bcull
142
143 fcull If the amount of available space or the number of available
144 files in the cache falls below either of these limits, then
145 culling is started.
146
147 bstop
148
149 fstop If the amount of available space or the number of available
150 files in the cache falls below either of these limits, then no
151 further allocation of disk space or files is permitted until
152 culling has raised things above these limits again.
153
154 These must be configured thusly:
155
156 0 <= bstop < bcull < brun < 100
157 0 <= fstop < fcull < frun < 100
158
159 Note that these are percentages of available space and available files,
160 and do not appear as 100 minus the percentage displayed by the df pro‐
161 gram.
162
163 The userspace daemon scans the cache to build up a table of cullable
164 objects. These are then culled in least recently used order. A new
165 scan of the cache is started as soon as space is made in the table.
166 Objects will be skipped if their atimes have changed or if the kernel
167 module says it is still using them.
168
169 Culling can be disabled with the nocull option.
170
172 cachefilesd(8), df(1), /usr/share/doc/cachefilesd/README
173
175 David Howells <dhowells@redhat.com>
176
177
178
179Linux 14 November 2005 CACHEFILESD.CONF(5)