• Home
  • Raw
  • Download

Lines Matching +full:d +full:- +full:cache +full:- +full:size

1 .. SPDX-License-Identifier: GPL-2.0
4 Cache on Already Mounted Filesystem
15 (*) Starting the cache.
19 (*) Cache culling.
21 (*) Cache structure.
31 (*) On-demand Read.
37 CacheFiles is a caching backend that's meant to use as a cache a directory on
40 CacheFiles uses a userspace daemon to do some of the cache management - such as
44 The filesystem and data integrity of the cache are only as good as those of the
49 CacheFiles creates a misc character device - "/dev/cachefiles" - that is used
51 and while it is open, a cache is at least partially in existence. The daemon
52 opens this and sends commands down it to control the cache.
54 CacheFiles is currently limited to a single cache.
57 the filesystem, shrinking the cache by culling the objects it contains to make
58 space if necessary - see the "Cache Culling" section. This means it can be
69 available in the system and in the cache filesystem:
71 - dnotify.
73 - extended attributes (xattrs).
75 - openat() and friends.
77 - bmap() support on files in the filesystem (FIBMAP ioctl).
79 - The use of bmap() to detect a partial page at the end of the file.
82 filesystems being used as a cache.
88 The cache is configured by a script in /etc/cachefilesd.conf. These commands
89 set up cache ready for use. The following script commands are available:
99 Specify the directory containing the root of the cache. Mandatory.
102 Specify a tag to FS-Cache to use in distinguishing multiple caches.
108 OR'd into the mask to collect various information:
121 Starting the Cache
124 The cache is started by running the daemon. The daemon opens the cache device,
125 configures the cache and tells it to begin caching. At that point the cache
126 binds to fscache and the cache becomes live.
130 /sbin/cachefilesd [-d]* [-s] [-n] [-f <configfile>]
134 ``-d``
138 ``-s``
141 ``-n``
144 ``-f <configfile>``
151 Do not mount other things within the cache as this will cause problems. The
152 kernel module contains its own very cut-down path walking facility that ignores
155 Do not create, rename or unlink files and directories in the cache while the
156 cache is active, as this may cause the state to become uncertain.
158 Renaming files in the cache might make objects appear to be other objects (the
161 Do not change or remove the extended attributes attached to cache files by the
162 cache as this will cause the cache state management to get confused.
164 Do not create files or directories in the cache, lest the cache get confused or
167 Do not chmod files in the cache. The module creates things with minimal
171 Cache Culling
174 The cache may need culling occasionally to make space. This involves
175 discarding objects from the cache that have been used less recently than
179 Cache culling is done on the basis of the percentage of blocks and the
184 If the amount of free space and the number of available files in the cache
189 cache falls below either of these limits, then culling is started.
193 cache falls below either of these limits, then no further allocation of
205 The userspace daemon scans the cache to build up a table of cullable objects.
206 These are then culled in least recently used order. A new scan of the cache is
211 Cache Structure
217 * cache/
220 The active cache objects all reside in the first directory. The CacheFiles
229 "J...". Note that the "cache/" directory is itself a special index.
232 if they do. Their filenames all begin "D..." or "E...". If represented as a
248 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400
249 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...DB1ry
250 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...N22ry
251 cache/@4a/I03nfs/@30/Ji000000000000000--fHg8hi8400/@75/Es0g000w...FP1ry
263 Note that keys are raw data, and not only may they exceed NAME_MAX in size,
268 "base-64" encode ones that aren't directly suitable. The two versions of
275 Data "D..." "E..."
282 Each object in the cache has an extended attribute label that holds the object
284 the netfs. The latter is used to detect stale objects in the cache and update
288 Note that CacheFiles will erase from the cache any file it doesn't recognise or
300 security context that is not appropriate for accessing the cache - either
301 because the files in the cache are inaccessible to that process, or because if
302 the process creates a file in the cache, that file may be inaccessible to other
306 fsgid and actor security label) that the process acts as - without changing the
311 When the CacheFiles module is asked to bind to its cache, it:
313 (1) Finds the security label attached to the root cache directory and uses
332 type_transition <daemon's-ID> kernel_t : process <module's-ID>;
340 and directories in the cache, to find and access directories and files in the
341 cache, to set and access extended attributes on cache objects, and to read and
342 write files in the cache.
346 not read or write files in the cache, and so it is precluded from accessing the
347 data cached therein; nor is it permitted to create new files in the cache.
352 https://people.redhat.com/~dhowells/fscache/cachefilesd-0.8.tar.bz2
362 If a non-RPM based system is being used, then copy the above files to their own
365 make -f /usr/share/selinux/devel/Makefile
366 semodule -i cachefilesd.pp
368 You will need checkpolicy and selinux-policy-devel installed prior to the
372 By default, the cache is located in /var/fscache, but if it is desirable that
375 cache.
377 For instructions on how to add an auxiliary policy to enable the cache to be
380 /usr/share/doc/cachefilesd-*/move-cache.txt
390 its own task_security structure, and redirects current->cred to point to it
395 may deny the CacheFiles access to the cache data because under some
402 preventing other processes from accessing the cache - including CacheFiles's
403 cache management daemon (cachefilesd).
406 issued the system call. We can't, however, just do an in-place change of the
412 objective security (task->real_cred) and the subjective security (task->cred).
431 If FS-Cache is compiled with the following option enabled::
446 between 0 jiffies and HZ-1 jiffies a variety of tasks took to run. The
458 Each step is 1 jiffy in size. The JIFS column indicates the particular
480 The appropriate set of values should be OR'd together and the result written to
488 On-demand Read
491 When working in its original mode, CacheFiles serves as a local cache for a
492 remote networking fs - while in on-demand read mode, CacheFiles can boost the
493 scenario where on-demand read semantics are needed, e.g. container image
496 The essential difference between these two modes is seen when a cache miss
498 server and then write it to the cache file; in on-demand read mode, fetching
499 the data and writing it into the cache is delegated to a user daemon.
501 ``CONFIG_CACHEFILES_ONDEMAND`` should be enabled to support on-demand read mode.
505 ----------------------
507 The on-demand read mode uses a simple protocol for communication between kernel
510 kernel --[request]--> user daemon --[reply]--> kernel
538 * ``object_id`` is a unique ID identifying the cache file operated on.
543 header and following type-specific payload.
546 Turning on On-demand Mode
547 -------------------------
554 When it is given the "ondemand" argument, i.e. "bind ondemand", on-demand read
559 ----------------
561 When the netfs opens a cache file for the first time, a request with the
576 The volume key is a NUL-terminated string; the cookie key is binary
579 * ``volume_key_size`` indicates the size of the volume key in bytes.
581 * ``cookie_key_size`` indicates the size of the cookie key in bytes.
583 * ``fd`` indicates an anonymous fd referring to the cache file, through
585 cache file.
589 the requested cache file. With the given anonymous fd, the user daemon can
590 fetch the data and write it to the cache file in the background, even when
591 kernel has not triggered a cache miss yet.
593 Be noted that each cache file has a unique object_id, while it may have multiple
600 ``/proc/sys/fs/nr_open`` and ``/proc/sys/fs/file-max``. Typically these needn't
613 * When >= 0, ``cache_size`` indicates the size of the cache file;
619 -----------------
628 ----------------
630 When a cache miss is encountered in on-demand read mode, CacheFiles will send a
648 and write it to the cache file identified by object_id.