Blame cachefilesd.conf.5

Packit 209f89
.\" -*- nroff -*-
Packit 209f89
.\" Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
Packit 209f89
.\" Written by David Howells (dhowells@redhat.com)
Packit 209f89
.\"
Packit 209f89
.\" This program is free software; you can redistribute it and/or
Packit 209f89
.\" modify it under the terms of the GNU General Public License
Packit 209f89
.\" as published by the Free Software Foundation; either version
Packit 209f89
.\" 2 of the License, or (at your option) any later version.
Packit 209f89
.\"
Packit 209f89
.TH CACHEFILESD.CONF 5 "14 November 2005" Linux "Cache Files Utilities"
Packit 209f89
.SH NAME
Packit 209f89
/etc/cachefilesd.conf \- Local file caching configuration file
Packit 209f89
.SH SYNOPSIS
Packit 209f89
.P
Packit 209f89
The configuration file for cachefilesd which can manage a persistent cache for
Packit 209f89
a variety of network filesystems using a set of files on an already mounted
Packit 209f89
filesystem as the data store.
Packit 209f89
.SH DESCRIPTION
Packit 209f89
.P
Packit 209f89
This configuration file can contain a number of commands.  Each one should be
Packit 209f89
on a separate line.  Blank lines and lines beginning with a '#' character are
Packit 209f89
considered to be comments and are discarded.
Packit 209f89
.P
Packit 209f89
The only mandatory command is:
Packit 209f89
.TP
Packit 209f89
.B dir <path>
Packit 209f89
This command specifies the directory containing the root of the cache.  It may
Packit 209f89
only specified once per configuration file.
Packit 209f89
.P
Packit 209f89
All the other commands are optional:
Packit 209f89
.TP
Packit 209f89
.B secctx <label>
Packit 209f89
Specify an LSM security context as which the kernel will perform operations to
Packit 209f89
access the cache.  The default is to use cachefilesd's security context.  Files
Packit 209f89
will be created in the cache with the label of directory specified to the 'dir'
Packit 209f89
command.
Packit 209f89
.TP
Packit 209f89
.B brun <N>%
Packit 209f89
.TP
Packit 209f89
.B bcull <N>%
Packit 209f89
.TP
Packit 209f89
.B bstop <N>%
Packit 209f89
.TP
Packit 209f89
.B frun <N>%
Packit 209f89
.TP
Packit 209f89
.B fcull <N>%
Packit 209f89
.TP
Packit 209f89
.B fstop <N>%
Packit 209f89
These commands configure the culling limits.  The defaults are 7% (run), 5%
Packit 209f89
(cull) and 1% (stop) respectively.  See the section on cache culling for more
Packit 209f89
information.
Packit 209f89
.IP
Packit 209f89
The commands beginning with a 'b' are file space (block) limits, those
Packit 209f89
beginning with an 'f' are file count limits.
Packit 209f89
.TP
Packit 209f89
.B tag <name>
Packit 209f89
This command specifies a tag to FS-Cache to use in distinguishing multiple
Packit 209f89
caches.  This is only required if more than one cache is going to be used.  The
Packit 209f89
default is "CacheFiles".
Packit 209f89
.TP
Packit 209f89
.B culltable <log2size>
Packit 209f89
This command specifies the size of the tables holding the lists of cullable
Packit 209f89
objects in the cache.  The bigger the number, the faster and more smoothly that
Packit 209f89
culling can proceed when there are many objects in the cache, but the more
Packit 209f89
memory will be consumed by cachefilesd.
Packit 209f89
.IP
Packit 209f89
The quantity is specified as log2 of the size actually required, for example 12
Packit 209f89
indicates a table of 4096 entries and 13 indicates 8192 entries.  The
Packit 209f89
permissible values are between 12 and 20, the latter indicating 1048576
Packit 209f89
entries.  The default is 12.
Packit 209f89
.TP
Packit 209f89
.B nocull
Packit 209f89
Disable culling.  Culling and building up the cull table take up a certain
Packit 209f89
amount of a systems resources, which may be undesirable.  Supplying this option
Packit 209f89
disables all culling activity.  The cache will keep building up to the limits
Packit 209f89
set and won't be shrunk, except by the removal of out-dated cache files.
Packit 209f89
.TP
Packit 209f89
.B resume_thresholds <blocks> <files>
Packit 209f89
This command specifies the amount of blocks or files that the kernel should let
Packit 209f89
go of before the daemon should resume from culling table scan suspension.
Packit 209f89
.IP
Packit 209f89
Scanning to refill the cull table is suspended when all the objects in a cache
Packit 209f89
are pinned by a live network filesystem in the kernel and there's nothing to
Packit 209f89
cull.
Packit 209f89
.IP
Packit 209f89
Either value can be "-" to indicate that this threshold should be ignored.
Packit 209f89
.TP
Packit 209f89
.B debug <mask>
Packit 209f89
This command specifies a numeric bitmask to control debugging in the kernel
Packit 209f89
module.  The default is zero (all off).  The following values can be OR'd into
Packit 209f89
the mask to collect various information:
Packit 209f89
.RS
Packit 209f89
.TP
Packit 209f89
.B 1
Packit 209f89
Turn on trace of function entry (_enter() macros)
Packit 209f89
.TP
Packit 209f89
.B 2
Packit 209f89
Turn on trace of function exit (_leave() macros)
Packit 209f89
.TP
Packit 209f89
.B 4
Packit 209f89
Turn on trace of internal debug points (_debug())
Packit 209f89
.RE
Packit 209f89
.IP
Packit 209f89
This mask can also be set through /sys/module/cachefiles/parameters/debug.
Packit 209f89
.RE
Packit 209f89
.SH EXAMPLES
Packit 209f89
.P
Packit 209f89
As an example, consider the following:
Packit 209f89
.P
Packit 209f89
.RS
Packit 209f89
dir /var/cache/fscache
Packit 209f89
.br
Packit 209f89
secctx cachefiles_kernel_t
Packit 209f89
.br
Packit 209f89
tag mycache
Packit 209f89
.br
Packit 209f89
brun 10%
Packit 209f89
.br
Packit 209f89
bcull 7%
Packit 209f89
.br
Packit 209f89
bstop 3%
Packit 209f89
.br
Packit 209f89
secctx system_u:system_r:cachefiles_kernel_t:s0
Packit 209f89
.RE
Packit 209f89
.P
Packit 209f89
This places the cache storage objects in a directory called
Packit 209f89
"/var/cache/fscache", names the cache "mycache", permits the cache to run
Packit 209f89
freely as long as there's at least 10% free space on /var/cache/fscache/,
Packit 209f89
starts culling the cache when the free space drops below 7% and stops writing
Packit 209f89
new stuff into the cache if the amount of free space drops below 3%.  If the
Packit 209f89
cache is suspended, it won't reactivate until the amount of free space rises
Packit 209f89
again to 10% or better.
Packit 209f89
.P
Packit 209f89
Furthermore, this will tell the kernel module the security context it should
Packit 209f89
use when accessing the cache (SELinux is assumed to be the LSM in this
Packit 209f89
example).  In this case, SELinux would use cachefiles_kernel_t as the key into
Packit 209f89
the policy.
Packit 209f89
.SH CACHE CULLING
Packit 209f89
.P
Packit 209f89
The cache may need culling occasionally to make space.  This involves
Packit 209f89
discarding objects from the cache that have been used less recently than
Packit 209f89
anything else.  Culling is based on the access time of data objects.  Empty
Packit 209f89
directories are culled if not in use.
Packit 209f89
.P
Packit 209f89
Cache culling is done on the basis of the percentage of blocks and the
Packit 209f89
percentage of files available in the underlying filesystem.  There are six
Packit 209f89
"limits":
Packit 209f89
.TP
Packit 209f89
.B brun
Packit 209f89
.TP
Packit 209f89
.B frun
Packit 209f89
If the amount of free space and the number of available files in the cache
Packit 209f89
rises above both these limits, then culling is turned off.
Packit 209f89
.TP
Packit 209f89
.B bcull
Packit 209f89
.TP
Packit 209f89
.B fcull
Packit 209f89
If the amount of available space or the number of available files in the cache
Packit 209f89
falls below either of these limits, then culling is started.
Packit 209f89
.TP
Packit 209f89
.B bstop
Packit 209f89
.TP
Packit 209f89
.B fstop
Packit 209f89
If the amount of available space or the number of available files in the cache
Packit 209f89
falls below either of these limits, then no further allocation of disk space or
Packit 209f89
files is permitted until culling has raised things above these limits again.
Packit 209f89
.P
Packit 209f89
These must be configured thusly:
Packit 209f89
.IP
Packit 209f89
0 <= bstop < bcull < brun < 100
Packit 209f89
.br
Packit 209f89
0 <= fstop < fcull < frun < 100
Packit 209f89
.P
Packit 209f89
Note that these are percentages of available space and available files, and do
Packit 209f89
\fInot\fP appear as 100 minus the percentage displayed by the \fBdf\fP program.
Packit 209f89
.P
Packit 209f89
The userspace daemon scans the cache to build up a table of cullable objects.
Packit 209f89
These are then culled in least recently used order.  A new scan of the cache is
Packit 209f89
started as soon as space is made in the table.  Objects will be skipped if
Packit 209f89
their atimes have changed or if the kernel module says it is still using them.
Packit 209f89
.P
Packit 209f89
Culling can be disabled with the \fBnocull\fP option.
Packit 209f89
.SH SEE ALSO
Packit 209f89
\fBcachefilesd\fR(8), \fBdf\fR(1), /usr/share/doc/cachefilesd/README
Packit 209f89
.SH AUTHORS
Packit 209f89
.br
Packit 209f89
David Howells <dhowells@redhat.com>