Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/eec0cfc268e8dca348f760224685100c9c2caba6.1588021877.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
d74802ad 09eac7c5

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