History

docs: filesystems: caching/cachefiles.txt: convert to ReST

- Add a SPDX header; - Adjust document title; - Mark literal blocks as such; - Add table markups; - Comment out text ToC for html/pdf output; - Add lists markups; - Add it to filesystems/caching/index.rst.

Mauro Carvalho Chehab committed 6 years ago

Commit d74802a1 parent 09eac7c4 files · +65 −81Browse files

Unified · Split

4 files
  1. Documentation/filesystems/caching/cachefiles.rst +61 −78
  2. Documentation/filesystems/caching/index.rst +1 −0
  3. MAINTAINERS +1 −1
  4. fs/cachefiles/Kconfig +2 −2
Documentation/filesystems/caching/cachefiles.rstrenamed from Documentation/filesystems/caching/cachefiles.txt+61−78
@@ -1,8 +1,10 @@
1 ===============================================1.. SPDX-License-Identifier: GPL-2.0
2 CacheFiles: CACHE ON ALREADY MOUNTED FILESYSTEM
3 ===============================================
4 2
5Contents:3===============================================
4CacheFiles: CACHE ON ALREADY MOUNTED FILESYSTEM
5===============================================
6
7.. Contents:
6 8
7 (*) Overview.9 (*) Overview.
8 10
@@ -27,8 +29,8 @@ Contents: · 18 unmodified lines
27 (*) Debugging.29 (*) Debugging.
28 30
29 31
30========32
31OVERVIEW33Overview
32========34========
33 35
34CacheFiles is a caching backend that's meant to use as a cache a directory on36CacheFiles is a caching backend that's meant to use as a cache a directory on
@@ -58,8 +60,8 @@ spare space and automatically contract when the set of data requires more · 23 unmodified lines
58space.60space.
59 61
60 62
61============63
62REQUIREMENTS64Requirements
63============65============
64 66
65The use of CacheFiles and its daemon requires the following features to be67The use of CacheFiles and its daemon requires the following features to be
@@ -79,84 +81,70 @@ It is strongly recommended that the "dir_index" option is enabled on Ext3 · 13 unmodified lines
79filesystems being used as a cache.81filesystems being used as a cache.
80 82
81 83
82=============84Configuration
83CONFIGURATION
84=============85=============
85 86
86The cache is configured by a script in /etc/cachefilesd.conf. These commands87The cache is configured by a script in /etc/cachefilesd.conf. These commands
87set up cache ready for use. The following script commands are available:88set up cache ready for use. The following script commands are available:
88 89
89 (*) brun <N>%90 brun <N>%, bcull <N>%, bstop <N>%, frun <N>%, fcull <N>%, fstop <N>%
90 (*) bcull <N>%
91 (*) bstop <N>%
92 (*) frun <N>%
93 (*) fcull <N>%
94 (*) fstop <N>%
95
96 Configure the culling limits. Optional. See the section on culling91 Configure the culling limits. Optional. See the section on culling
97 The defaults are 7% (run), 5% (cull) and 1% (stop) respectively.92 The defaults are 7% (run), 5% (cull) and 1% (stop) respectively.
98 93
99 The commands beginning with a 'b' are file space (block) limits, those94 The commands beginning with a 'b' are file space (block) limits, those
100 beginning with an 'f' are file count limits.95 beginning with an 'f' are file count limits.
101 96
102 (*) dir <path>97 dir <path>
103
104 Specify the directory containing the root of the cache. Mandatory.98 Specify the directory containing the root of the cache. Mandatory.
105 99
106 (*) tag <name>100 tag <name>
107
108 Specify a tag to FS-Cache to use in distinguishing multiple caches.101 Specify a tag to FS-Cache to use in distinguishing multiple caches.
109 Optional. The default is "CacheFiles".102 Optional. The default is "CacheFiles".
110 103
111 (*) debug <mask>104 debug <mask>
112
113 Specify a numeric bitmask to control debugging in the kernel module.105 Specify a numeric bitmask to control debugging in the kernel module.
114 Optional. The default is zero (all off). The following values can be106 Optional. The default is zero (all off). The following values can be
115 OR'd into the mask to collect various information:107 OR'd into the mask to collect various information:
116 108
109 == =================================================
117 1 Turn on trace of function entry (_enter() macros)110 1 Turn on trace of function entry (_enter() macros)
118 2 Turn on trace of function exit (_leave() macros)111 2 Turn on trace of function exit (_leave() macros)
119 4 Turn on trace of internal debug points (_debug())112 4 Turn on trace of internal debug points (_debug())
113 == =================================================
120 114
121 This mask can also be set through sysfs, eg:115 This mask can also be set through sysfs, eg::
122 116
123 echo 5 >/sys/modules/cachefiles/parameters/debug117 echo 5 >/sys/modules/cachefiles/parameters/debug
124 118
125 119
126==================120Starting the Cache
127STARTING THE CACHE
128==================121==================
129 122
130The cache is started by running the daemon. The daemon opens the cache device,123The cache is started by running the daemon. The daemon opens the cache device,
131configures the cache and tells it to begin caching. At that point the cache124configures the cache and tells it to begin caching. At that point the cache
132binds to fscache and the cache becomes live.125binds to fscache and the cache becomes live.
133 126
134The daemon is run as follows:127The daemon is run as follows::
135 128
136 /sbin/cachefilesd [-d]* [-s] [-n] [-f <configfile>]129 /sbin/cachefilesd [-d]* [-s] [-n] [-f <configfile>]
137 130
138The flags are:131The flags are:
139 132
140 (*) -d133 ``-d``
141
142 Increase the debugging level. This can be specified multiple times and134 Increase the debugging level. This can be specified multiple times and
143 is cumulative with itself.135 is cumulative with itself.
144 136
145 (*) -s137 ``-s``
146
147 Send messages to stderr instead of syslog.138 Send messages to stderr instead of syslog.
148 139
149 (*) -n140 ``-n``
150
151 Don't daemonise and go into background.141 Don't daemonise and go into background.
152 142
153 (*) -f <configfile>143 ``-f <configfile>``
154
155 Use an alternative configuration file rather than the default one.144 Use an alternative configuration file rather than the default one.
156 145
157 146
158===============147Things to Avoid
159THINGS TO AVOID
160===============148===============
161 149
162Do not mount other things within the cache as this will cause problems. The150Do not mount other things within the cache as this will cause problems. The
@@ -179,8 +167,7 @@ Do not chmod files in the cache. The module creates things with minimal · 16 unmodified lines
179permissions to prevent random users being able to access them directly.167permissions to prevent random users being able to access them directly.
180 168
181 169
182=============170Cache Culling
183CACHE CULLING
184=============171=============
185 172
186The cache may need culling occasionally to make space. This involves173The cache may need culling occasionally to make space. This involves
@@ -192,27 +179,21 @@ Cache culling is done on the basis of the percentage of blocks and the · 5 unmodified lines
192percentage of files available in the underlying filesystem. There are six179percentage of files available in the underlying filesystem. There are six
193"limits":180"limits":
194 181
195 (*) brun182 brun, frun
196 (*) frun
197
198 If the amount of free space and the number of available files in the cache183 If the amount of free space and the number of available files in the cache
199 rises above both these limits, then culling is turned off.184 rises above both these limits, then culling is turned off.
200 185
201 (*) bcull186 bcull, fcull
202 (*) fcull
203
204 If the amount of available space or the number of available files in the187 If the amount of available space or the number of available files in the
205 cache falls below either of these limits, then culling is started.188 cache falls below either of these limits, then culling is started.
206 189
207 (*) bstop190 bstop, fstop
208 (*) fstop
209
210 If the amount of available space or the number of available files in the191 If the amount of available space or the number of available files in the
211 cache falls below either of these limits, then no further allocation of192 cache falls below either of these limits, then no further allocation of
212 disk space or files is permitted until culling has raised things above193 disk space or files is permitted until culling has raised things above
213 these limits again.194 these limits again.
214 195
215These must be configured thusly:196These must be configured thusly::
216 197
217 0 <= bstop < bcull < brun < 100198 0 <= bstop < bcull < brun < 100
218 0 <= fstop < fcull < frun < 100199 0 <= fstop < fcull < frun < 100
@@ -226,16 +207,14 @@ started as soon as space is made in the table. Objects will be skipped if · 7 unmodified lines
226their atimes have changed or if the kernel module says it is still using them.207their atimes have changed or if the kernel module says it is still using them.
227 208
228 209
229===============210Cache Structure
230CACHE STRUCTURE
231===============211===============
232 212
233The CacheFiles module will create two directories in the directory it was213The CacheFiles module will create two directories in the directory it was
234given:214given:
235 215
236 (*) cache/216 * cache/
237 217 * graveyard/
238 (*) graveyard/
239 218
240The active cache objects all reside in the first directory. The CacheFiles219The active cache objects all reside in the first directory. The CacheFiles
241kernel module moves any retired or culled objects that it can't simply unlink220kernel module moves any retired or culled objects that it can't simply unlink
@@ -261,10 +240,10 @@ If an object has children, then it will be represented as a directory. · 19 unmodified lines
261Immediately in the representative directory are a collection of directories240Immediately in the representative directory are a collection of directories
262named for hash values of the child object keys with an '@' prepended. Into241named for hash values of the child object keys with an '@' prepended. Into
263this directory, if possible, will be placed the representations of the child242this directory, if possible, will be placed the representations of the child
264objects:243objects::
265 244
266 INDEX INDEX INDEX DATA FILES245 /INDEX /INDEX /INDEX /DATA FILES
267 ========= ========== ================================= ================246 /=========/==========/=================================/================
268 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400247 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400
269 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...DB1ry248 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...DB1ry
270 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...N22ry249 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...N22ry
@@ -275,7 +254,7 @@ If the key is so long that it exceeds NAME_MAX with the decorations added on to · 4 unmodified lines
275it, then it will be cut into pieces, the first few of which will be used to254it, then it will be cut into pieces, the first few of which will be used to
276make a nest of directories, and the last one of which will be the objects255make a nest of directories, and the last one of which will be the objects
277inside the last directory. The names of the intermediate directories will have256inside the last directory. The names of the intermediate directories will have
278'+' prepended:257'+' prepended::
279 258
280 J1223/@23/+xy...z/+kl...m/Epqr259 J1223/@23/+xy...z/+kl...m/Epqr
281 260
@@ -288,11 +267,13 @@ To handle this, CacheFiles will use a suitably printable filename directly and · 6 unmodified lines
288"base-64" encode ones that aren't directly suitable. The two versions of267"base-64" encode ones that aren't directly suitable. The two versions of
289object filenames indicate the encoding:268object filenames indicate the encoding:
290 269
270 =============== =============== ===============
291 OBJECT TYPE PRINTABLE ENCODED271 OBJECT TYPE PRINTABLE ENCODED
292 =============== =============== ===============272 =============== =============== ===============
293 Index "I..." "J..."273 Index "I..." "J..."
294 Data "D..." "E..."274 Data "D..." "E..."
295 Special "S..." "T..."275 Special "S..." "T..."
276 =============== =============== ===============
296 277
297Intermediate directories are always "@" or "+" as appropriate.278Intermediate directories are always "@" or "+" as appropriate.
298 279
@@ -307,8 +288,7 @@ Note that CacheFiles will erase from the cache any file it doesn't recognise or · 8 unmodified lines
307any file of an incorrect type (such as a FIFO file or a device file).288any file of an incorrect type (such as a FIFO file or a device file).
308 289
309 290
310==========================291Security Model and SELinux
311SECURITY MODEL AND SELINUX
312==========================292==========================
313 293
314CacheFiles is implemented to deal properly with the LSM security features of294CacheFiles is implemented to deal properly with the LSM security features of
@@ -331,26 +311,26 @@ When the CacheFiles module is asked to bind to its cache, it: · 16 unmodified lines
331 311
332 (1) Finds the security label attached to the root cache directory and uses312 (1) Finds the security label attached to the root cache directory and uses
333 that as the security label with which it will create files. By default,313 that as the security label with which it will create files. By default,
334 this is:314 this is::
335 315
336 cachefiles_var_t316 cachefiles_var_t
337 317
338 (2) Finds the security label of the process which issued the bind request318 (2) Finds the security label of the process which issued the bind request
339 (presumed to be the cachefilesd daemon), which by default will be:319 (presumed to be the cachefilesd daemon), which by default will be::
340 320
341 cachefilesd_t321 cachefilesd_t
342 322
343 and asks LSM to supply a security ID as which it should act given the323 and asks LSM to supply a security ID as which it should act given the
344 daemon's label. By default, this will be:324 daemon's label. By default, this will be::
345 325
346 cachefiles_kernel_t326 cachefiles_kernel_t
347 327
348 SELinux transitions the daemon's security ID to the module's security ID328 SELinux transitions the daemon's security ID to the module's security ID
349 based on a rule of this form in the policy.329 based on a rule of this form in the policy::
350 330
351 type_transition <daemon's-ID> kernel_t : process <module's-ID>;331 type_transition <daemon's-ID> kernel_t : process <module's-ID>;
352 332
353 For instance:333 For instance::
354 334
355 type_transition cachefilesd_t kernel_t : process cachefiles_kernel_t;335 type_transition cachefilesd_t kernel_t : process cachefiles_kernel_t;
356 336
@@ -370,7 +350,7 @@ There are policy source files available in: · 13 unmodified lines
370 350
371 http://people.redhat.com/~dhowells/fscache/cachefilesd-0.8.tar.bz2351 http://people.redhat.com/~dhowells/fscache/cachefilesd-0.8.tar.bz2
372 352
373and later versions. In that tarball, see the files:353and later versions. In that tarball, see the files::
374 354
375 cachefilesd.te355 cachefilesd.te
376 cachefilesd.fc356 cachefilesd.fc
@@ -379,7 +359,7 @@ and later versions. In that tarball, see the files: · 2 unmodified lines
379They are built and installed directly by the RPM.359They are built and installed directly by the RPM.
380 360
381If a non-RPM based system is being used, then copy the above files to their own361If a non-RPM based system is being used, then copy the above files to their own
382directory and run:362directory and run::
383 363
384 make -f /usr/share/selinux/devel/Makefile364 make -f /usr/share/selinux/devel/Makefile
385 semodule -i cachefilesd.pp365 semodule -i cachefilesd.pp
@@ -394,7 +374,7 @@ an auxiliary policy must be installed to label the alternate location of the · 8 unmodified lines
394cache.374cache.
395 375
396For instructions on how to add an auxiliary policy to enable the cache to be376For instructions on how to add an auxiliary policy to enable the cache to be
397located elsewhere when SELinux is in enforcing mode, please see:377located elsewhere when SELinux is in enforcing mode, please see::
398 378
399 /usr/share/doc/cachefilesd-*/move-cache.txt379 /usr/share/doc/cachefilesd-*/move-cache.txt
400 380
@@ -402,8 +382,7 @@ When the cachefilesd rpm is installed; alternatively, the document can be found · 1 unmodified line
402in the sources.382in the sources.
403 383
404 384
405==================385A Note on Security
406A NOTE ON SECURITY
407==================386==================
408 387
409CacheFiles makes use of the split security in the task_struct. It allocates388CacheFiles makes use of the split security in the task_struct. It allocates
@@ -445,17 +424,18 @@ for CacheFiles to run in a context of a specific security label, or to create · 35 unmodified lines
445files and directories with another security label.424files and directories with another security label.
446 425
447 426
448=======================427Statistical Information
449STATISTICAL INFORMATION
450=======================428=======================
451 429
452If FS-Cache is compiled with the following option enabled:430If FS-Cache is compiled with the following option enabled::
453 431
454 CONFIG_CACHEFILES_HISTOGRAM=y432 CONFIG_CACHEFILES_HISTOGRAM=y
455 433
456then it will gather certain statistics and display them through a proc file.434then it will gather certain statistics and display them through a proc file.
457 435
458 (*) /proc/fs/cachefiles/histogram436 /proc/fs/cachefiles/histogram
437
438 ::
459 439
460 cat /proc/fs/cachefiles/histogram440 cat /proc/fs/cachefiles/histogram
461 JIFS SECS LOOKUPS MKDIRS CREATES441 JIFS SECS LOOKUPS MKDIRS CREATES
@@ -465,36 +445,39 @@ then it will gather certain statistics and display them through a proc file. · 3 unmodified lines
465 between 0 jiffies and HZ-1 jiffies a variety of tasks took to run. The445 between 0 jiffies and HZ-1 jiffies a variety of tasks took to run. The
466 columns are as follows:446 columns are as follows:
467 447
448 ======= =======================================================
468 COLUMN TIME MEASUREMENT449 COLUMN TIME MEASUREMENT
469 ======= =======================================================450 ======= =======================================================
470 LOOKUPS Length of time to perform a lookup on the backing fs451 LOOKUPS Length of time to perform a lookup on the backing fs
471 MKDIRS Length of time to perform a mkdir on the backing fs452 MKDIRS Length of time to perform a mkdir on the backing fs
472 CREATES Length of time to perform a create on the backing fs453 CREATES Length of time to perform a create on the backing fs
454 ======= =======================================================
473 455
474 Each row shows the number of events that took a particular range of times.456 Each row shows the number of events that took a particular range of times.
475 Each step is 1 jiffy in size. The JIFS column indicates the particular457 Each step is 1 jiffy in size. The JIFS column indicates the particular
476 jiffy range covered, and the SECS field the equivalent number of seconds.458 jiffy range covered, and the SECS field the equivalent number of seconds.
477 459
478 460
479=========461Debugging
480DEBUGGING
481=========462=========
482 463
483If CONFIG_CACHEFILES_DEBUG is enabled, the CacheFiles facility can have runtime464If CONFIG_CACHEFILES_DEBUG is enabled, the CacheFiles facility can have runtime
484debugging enabled by adjusting the value in:465debugging enabled by adjusting the value in::
485 466
486 /sys/module/cachefiles/parameters/debug467 /sys/module/cachefiles/parameters/debug
487 468
488This is a bitmask of debugging streams to enable:469This is a bitmask of debugging streams to enable:
489 470
471 ======= ======= =============================== =======================
490 BIT VALUE STREAM POINT472 BIT VALUE STREAM POINT
491 ======= ======= =============================== =======================473 ======= ======= =============================== =======================
492 0 1 General Function entry trace474 0 1 General Function entry trace
493 1 2 Function exit trace475 1 2 Function exit trace
494 2 4 General476 2 4 General
477 ======= ======= =============================== =======================
495 478
496The appropriate set of values should be OR'd together and the result written to479The appropriate set of values should be OR'd together and the result written to
497the control file. For example:480the control file. For example::
498 481
499 echo $((1|4|8)) >/sys/module/cachefiles/parameters/debug482 echo $((1|4|8)) >/sys/module/cachefiles/parameters/debug
500 483
Documentation/filesystems/caching/index.rst+1−0
@@ -8,5 +8,6 @@ Filesystem Caching · 7 unmodified lines
8 8
9 fscache9 fscache
10 object10 object
11 cachefiles
11 netfs-api12 netfs-api
12 operations13 operations
MAINTAINERS+1−1
@@ -3731,7 +3731,7 @@ CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS · 3730 unmodified lines
3731M: David Howells <dhowells@redhat.com>3731M: David Howells <dhowells@redhat.com>
3732L: linux-cachefs@redhat.com (moderated for non-subscribers)3732L: linux-cachefs@redhat.com (moderated for non-subscribers)
3733S: Supported3733S: Supported
3734F: Documentation/filesystems/caching/cachefiles.txt3734F: Documentation/filesystems/caching/cachefiles.rst
3735F: fs/cachefiles/3735F: fs/cachefiles/
3736 3736
3737CADENCE MIPI-CSI2 BRIDGES3737CADENCE MIPI-CSI2 BRIDGES
fs/cachefiles/Kconfig+2−2
@@ -8,7 +8,7 @@ config CACHEFILES · 7 unmodified lines
8 filesystems - primarily networking filesystems - thus allowing fast8 filesystems - primarily networking filesystems - thus allowing fast
9 local disk to enhance the speed of slower devices.9 local disk to enhance the speed of slower devices.
10 10
11 See Documentation/filesystems/caching/cachefiles.txt for more11 See Documentation/filesystems/caching/cachefiles.rst for more
12 information.12 information.
13 13
14config CACHEFILES_DEBUG14config CACHEFILES_DEBUG
@@ -36,5 +36,5 @@ config CACHEFILES_HISTOGRAM · 21 unmodified lines
36 bouncing between CPUs. On the other hand, the histogram may be36 bouncing between CPUs. On the other hand, the histogram may be
37 useful for debugging purposes. Saying 'N' here is recommended.37 useful for debugging purposes. Saying 'N' here is recommended.
38 38
39 See Documentation/filesystems/caching/cachefiles.txt for more39 See Documentation/filesystems/caching/cachefiles.rst for more
40 information.40 information.