Skip to content

Commit d74802a

Browse files
mchehabJonathan Corbet
authored andcommitted
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>
1 parent 09eac7c commit d74802a

4 files changed

Lines changed: 65 additions & 81 deletions

File tree

Documentation/filesystems/caching/cachefiles.txt renamed to Documentation/filesystems/caching/cachefiles.rst

Lines changed: 61 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
===============================================
2-
CacheFiles: CACHE ON ALREADY MOUNTED FILESYSTEM
3-
===============================================
1+
.. SPDX-License-Identifier: GPL-2.0
42
5-
Contents:
3+
===============================================
4+
CacheFiles: CACHE ON ALREADY MOUNTED FILESYSTEM
5+
===============================================
6+
7+
.. Contents:
68
79
(*) Overview.
810
@@ -27,8 +29,8 @@ Contents:
2729
(*) Debugging.
2830
2931
30-
========
31-
OVERVIEW
32+
33+
Overview
3234
========
3335

3436
CacheFiles 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
5860
space.
5961

6062

61-
============
62-
REQUIREMENTS
63+
64+
Requirements
6365
============
6466

6567
The 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
7981
filesystems being used as a cache.
8082

8183

82-
=============
83-
CONFIGURATION
84+
Configuration
8485
=============
8586

8687
The cache is configured by a script in /etc/cachefilesd.conf. These commands
8788
set up cache ready for use. The following script commands are available:
8889

89-
(*) brun <N>%
90-
(*) bcull <N>%
91-
(*) bstop <N>%
92-
(*) frun <N>%
93-
(*) fcull <N>%
94-
(*) fstop <N>%
95-
90+
brun <N>%, bcull <N>%, bstop <N>%, frun <N>%, fcull <N>%, fstop <N>%
9691
Configure the culling limits. Optional. See the section on culling
9792
The defaults are 7% (run), 5% (cull) and 1% (stop) respectively.
9893

9994
The commands beginning with a 'b' are file space (block) limits, those
10095
beginning with an 'f' are file count limits.
10196

102-
(*) dir <path>
103-
97+
dir <path>
10498
Specify the directory containing the root of the cache. Mandatory.
10599

106-
(*) tag <name>
107-
100+
tag <name>
108101
Specify a tag to FS-Cache to use in distinguishing multiple caches.
109102
Optional. The default is "CacheFiles".
110103

111-
(*) debug <mask>
112-
104+
debug <mask>
113105
Specify a numeric bitmask to control debugging in the kernel module.
114106
Optional. The default is zero (all off). The following values can be
115107
OR'd into the mask to collect various information:
116108

109+
== =================================================
117110
1 Turn on trace of function entry (_enter() macros)
118111
2 Turn on trace of function exit (_leave() macros)
119112
4 Turn on trace of internal debug points (_debug())
113+
== =================================================
120114

121-
This mask can also be set through sysfs, eg:
115+
This mask can also be set through sysfs, eg::
122116

123117
echo 5 >/sys/modules/cachefiles/parameters/debug
124118

125119

126-
==================
127-
STARTING THE CACHE
120+
Starting the Cache
128121
==================
129122

130123
The cache is started by running the daemon. The daemon opens the cache device,
131124
configures the cache and tells it to begin caching. At that point the cache
132125
binds to fscache and the cache becomes live.
133126

134-
The daemon is run as follows:
127+
The daemon is run as follows::
135128

136129
/sbin/cachefilesd [-d]* [-s] [-n] [-f <configfile>]
137130

138131
The flags are:
139132

140-
(*) -d
141-
133+
``-d``
142134
Increase the debugging level. This can be specified multiple times and
143135
is cumulative with itself.
144136

145-
(*) -s
146-
137+
``-s``
147138
Send messages to stderr instead of syslog.
148139

149-
(*) -n
150-
140+
``-n``
151141
Don't daemonise and go into background.
152142

153-
(*) -f <configfile>
154-
143+
``-f <configfile>``
155144
Use an alternative configuration file rather than the default one.
156145

157146

158-
===============
159-
THINGS TO AVOID
147+
Things to Avoid
160148
===============
161149

162150
Do 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
179167
permissions to prevent random users being able to access them directly.
180168

181169

182-
=============
183-
CACHE CULLING
170+
Cache Culling
184171
=============
185172

186173
The 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
192179
percentage of files available in the underlying filesystem. There are six
193180
"limits":
194181

195-
(*) brun
196-
(*) frun
197-
182+
brun, frun
198183
If the amount of free space and the number of available files in the cache
199184
rises above both these limits, then culling is turned off.
200185

201-
(*) bcull
202-
(*) fcull
203-
186+
bcull, fcull
204187
If the amount of available space or the number of available files in the
205188
cache falls below either of these limits, then culling is started.
206189

207-
(*) bstop
208-
(*) fstop
209-
190+
bstop, fstop
210191
If the amount of available space or the number of available files in the
211192
cache falls below either of these limits, then no further allocation of
212193
disk space or files is permitted until culling has raised things above
213194
these limits again.
214195

215-
These must be configured thusly:
196+
These must be configured thusly::
216197

217198
0 <= bstop < bcull < brun < 100
218199
0 <= fstop < fcull < frun < 100
@@ -226,16 +207,14 @@ started as soon as space is made in the table. Objects will be skipped if
226207
their atimes have changed or if the kernel module says it is still using them.
227208

228209

229-
===============
230-
CACHE STRUCTURE
210+
Cache Structure
231211
===============
232212

233213
The CacheFiles module will create two directories in the directory it was
234214
given:
235215

236-
(*) cache/
237-
238-
(*) graveyard/
216+
* cache/
217+
* graveyard/
239218

240219
The active cache objects all reside in the first directory. The CacheFiles
241220
kernel 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.
261240
Immediately in the representative directory are a collection of directories
262241
named for hash values of the child object keys with an '@' prepended. Into
263242
this directory, if possible, will be placed the representations of the child
264-
objects:
243+
objects::
265244

266-
INDEX INDEX INDEX DATA FILES
267-
========= ========== ================================= ================
245+
/INDEX /INDEX /INDEX /DATA FILES
246+
/=========/==========/=================================/================
268247
cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400
269248
cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...DB1ry
270249
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
275254
it, then it will be cut into pieces, the first few of which will be used to
276255
make a nest of directories, and the last one of which will be the objects
277256
inside the last directory. The names of the intermediate directories will have
278-
'+' prepended:
257+
'+' prepended::
279258

280259
J1223/@23/+xy...z/+kl...m/Epqr
281260

@@ -288,11 +267,13 @@ To handle this, CacheFiles will use a suitably printable filename directly and
288267
"base-64" encode ones that aren't directly suitable. The two versions of
289268
object filenames indicate the encoding:
290269

270+
=============== =============== ===============
291271
OBJECT TYPE PRINTABLE ENCODED
292272
=============== =============== ===============
293273
Index "I..." "J..."
294274
Data "D..." "E..."
295275
Special "S..." "T..."
276+
=============== =============== ===============
296277

297278
Intermediate directories are always "@" or "+" as appropriate.
298279

@@ -307,8 +288,7 @@ Note that CacheFiles will erase from the cache any file it doesn't recognise or
307288
any file of an incorrect type (such as a FIFO file or a device file).
308289

309290

310-
==========================
311-
SECURITY MODEL AND SELINUX
291+
Security Model and SELinux
312292
==========================
313293

314294
CacheFiles 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:
331311

332312
(1) Finds the security label attached to the root cache directory and uses
333313
that as the security label with which it will create files. By default,
334-
this is:
314+
this is::
335315

336316
cachefiles_var_t
337317

338318
(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::
340320

341321
cachefilesd_t
342322

343323
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::
345325

346326
cachefiles_kernel_t
347327

348328
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::
350330

351331
type_transition <daemon's-ID> kernel_t : process <module's-ID>;
352332

353-
For instance:
333+
For instance::
354334

355335
type_transition cachefilesd_t kernel_t : process cachefiles_kernel_t;
356336

@@ -370,7 +350,7 @@ There are policy source files available in:
370350

371351
http://people.redhat.com/~dhowells/fscache/cachefilesd-0.8.tar.bz2
372352

373-
and later versions. In that tarball, see the files:
353+
and later versions. In that tarball, see the files::
374354

375355
cachefilesd.te
376356
cachefilesd.fc
@@ -379,7 +359,7 @@ and later versions. In that tarball, see the files:
379359
They are built and installed directly by the RPM.
380360

381361
If a non-RPM based system is being used, then copy the above files to their own
382-
directory and run:
362+
directory and run::
383363

384364
make -f /usr/share/selinux/devel/Makefile
385365
semodule -i cachefilesd.pp
@@ -394,16 +374,15 @@ an auxiliary policy must be installed to label the alternate location of the
394374
cache.
395375

396376
For instructions on how to add an auxiliary policy to enable the cache to be
397-
located elsewhere when SELinux is in enforcing mode, please see:
377+
located elsewhere when SELinux is in enforcing mode, please see::
398378

399379
/usr/share/doc/cachefilesd-*/move-cache.txt
400380

401381
When the cachefilesd rpm is installed; alternatively, the document can be found
402382
in the sources.
403383

404384

405-
==================
406-
A NOTE ON SECURITY
385+
A Note on Security
407386
==================
408387

409388
CacheFiles 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
445424
files and directories with another security label.
446425

447426

448-
=======================
449-
STATISTICAL INFORMATION
427+
Statistical Information
450428
=======================
451429

452-
If FS-Cache is compiled with the following option enabled:
430+
If FS-Cache is compiled with the following option enabled::
453431

454432
CONFIG_CACHEFILES_HISTOGRAM=y
455433

456434
then it will gather certain statistics and display them through a proc file.
457435

458-
(*) /proc/fs/cachefiles/histogram
436+
/proc/fs/cachefiles/histogram
437+
438+
::
459439

460440
cat /proc/fs/cachefiles/histogram
461441
JIFS SECS LOOKUPS MKDIRS CREATES
@@ -465,36 +445,39 @@ then it will gather certain statistics and display them through a proc file.
465445
between 0 jiffies and HZ-1 jiffies a variety of tasks took to run. The
466446
columns are as follows:
467447

448+
======= =======================================================
468449
COLUMN TIME MEASUREMENT
469450
======= =======================================================
470451
LOOKUPS Length of time to perform a lookup on the backing fs
471452
MKDIRS Length of time to perform a mkdir on the backing fs
472453
CREATES Length of time to perform a create on the backing fs
454+
======= =======================================================
473455

474456
Each row shows the number of events that took a particular range of times.
475457
Each step is 1 jiffy in size. The JIFS column indicates the particular
476458
jiffy range covered, and the SECS field the equivalent number of seconds.
477459

478460

479-
=========
480-
DEBUGGING
461+
Debugging
481462
=========
482463

483464
If CONFIG_CACHEFILES_DEBUG is enabled, the CacheFiles facility can have runtime
484-
debugging enabled by adjusting the value in:
465+
debugging enabled by adjusting the value in::
485466

486467
/sys/module/cachefiles/parameters/debug
487468

488469
This is a bitmask of debugging streams to enable:
489470

471+
======= ======= =============================== =======================
490472
BIT VALUE STREAM POINT
491473
======= ======= =============================== =======================
492474
0 1 General Function entry trace
493475
1 2 Function exit trace
494476
2 4 General
477+
======= ======= =============================== =======================
495478

496479
The appropriate set of values should be OR'd together and the result written to
497-
the control file. For example:
480+
the control file. For example::
498481

499482
echo $((1|4|8)) >/sys/module/cachefiles/parameters/debug
500483

‎Documentation/filesystems/caching/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ Filesystem Caching
88

99
fscache
1010
object
11+
cachefiles
1112
netfs-api
1213
operations

‎MAINTAINERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3731,7 +3731,7 @@ CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS
37313731
M: David Howells <dhowells@redhat.com>
37323732
L: linux-cachefs@redhat.com (moderated for non-subscribers)
37333733
S: Supported
3734-
F: Documentation/filesystems/caching/cachefiles.txt
3734+
F: Documentation/filesystems/caching/cachefiles.rst
37353735
F: fs/cachefiles/
37363736

37373737
CADENCE MIPI-CSI2 BRIDGES

0 commit comments

Comments
 (0)