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 debug <mask>
75 This command specifies a numeric bitmask to control debugging in
76 the kernel module. The default is zero (all off). The follow‐
77 ing values can be OR'd into the mask to collect various informa‐
78 tion:
79
80 1 Turn on trace of function entry (_enter() macros)
81
82 2 Turn on trace of function exit (_leave() macros)
83
84 4 Turn on trace of internal debug points (_debug())
85
86 This mask can also be set through /sys/module/cachefiles/parame‐
87 ters/debug.
88
90 As an example, consider the following:
91
92 dir /var/cache/fscache
93 secctx cachefiles_kernel_t
94 tag mycache
95 brun 10%
96 bcull 7%
97 bstop 3%
98 secctx system_u:system_r:cachefiles_kernel_t:s0
99
100 This places the cache storage objects in a directory called
101 "/var/cache/fscache", names the cache "mycache", permits the cache to
102 run freely as long as there's at least 10% free space on
103 /var/cache/fscache/, starts culling the cache when the free space drops
104 below 7% and stops writing new stuff into the cache if the amount of
105 free space drops below 3%. If the cache is suspended, it won't reacti‐
106 vate until the amount of free space rises again to 10% or better.
107
108 Furthermore, this will tell the kernel module the security context it
109 should use when accessing the cache (SELinux is assumed to be the LSM
110 in this example). In this case, SELinux would use cachefiles_kernel_t
111 as the key into the policy.
112
114 The cache may need culling occasionally to make space. This involves
115 discarding objects from the cache that have been used less recently
116 than anything else. Culling is based on the access time of data
117 objects. Empty directories are culled if not in use.
118
119 Cache culling is done on the basis of the percentage of blocks and the
120 percentage of files available in the underlying filesystem. There are
121 six "limits":
122
123 brun
124
125 frun If the amount of free space and the number of available files in
126 the cache rises above both these limits, then culling is turned
127 off.
128
129 bcull
130
131 fcull If the amount of available space or the number of available
132 files in the cache falls below either of these limits, then
133 culling is started.
134
135 bstop
136
137 fstop If the amount of available space or the number of available
138 files in the cache falls below either of these limits, then no
139 further allocation of disk space or files is permitted until
140 culling has raised things above these limits again.
141
142 These must be configured thusly:
143
144 0 <= bstop < bcull < brun < 100
145 0 <= fstop < fcull < frun < 100
146
147 Note that these are percentages of available space and available files,
148 and do not appear as 100 minus the percentage displayed by the df pro‐
149 gram.
150
151 The userspace daemon scans the cache to build up a table of cullable
152 objects. These are then culled in least recently used order. A new
153 scan of the cache is started as soon as space is made in the table.
154 Objects will be skipped if their atimes have changed or if the kernel
155 module says it is still using them.
156
157 Culling can be disabled with the nocull option.
158
160 cachefilesd(8), df(1), /usr/share/doc/cachefilesd-*/README
161
163 The cachefilesd software has been developed by David Howells
164
165
166
167Linux 14 November 2005 CACHEFILESD.CONF(5)