Skip to content

FS-Cache: Generic filesystem caching facility

David Howells linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12FS-Cache: Handle -Wsign-compare in i386 bitopsinclude/asm-i386/bitops.h+2 -20 replies
2/12FS-Cache: Permit multiple inclusion of linux/pagevec.hinclude/linux/pagevec.h+5 -00 replies
3/12FS-Cache: Add list_for_each_entry_safe_reverse()include/linux/list.h+14 -00 replies
4/12FS-Cache: Permit pre-allocation of radix-tree nodesinclude/linux/radix-tree.h include/linux/sched.h kernel/exit.c +2 more+122 -310 replies
5/12FS-Cache: Release page->private in failed readaheadmm/readahead.c+16 -00 replies
6/12FS-Cache: Add a function to replace a page in the pagecacheinclude/linux/pagemap.h mm/filemap.c+36 -00 replies
7/12FS-Cache: Export a couple of VM functionsmm/page-writeback.c mm/swap.c+3 -00 replies
8/12FS-Cache: Add generic filesystem cache core modulefs/Kconfig fs/Makefile fs/fscache/Makefile +7 more+2574 -00 replies
9/12FS-Cache: Add documentation for FS-Cache and its interfacesDocumentation/filesystems/caching/backend-api.txt Documentation/filesystems/caching/fscache.txt Documentation/filesystems/caching/netfs-api.txt+1210 -00 replies
10/12FS-Cache: Make kAFS use FS-Cachefs/Kconfig fs/afs/cache.h fs/afs/cell.c +16 more+655 -4060 replies
11/12FS-Cache: CacheFS: Add cache on blockdevice cache backendfs/Kconfig fs/Makefile fs/cachefs/Makefile +32 more+17521 -00 replies
12/12FS-Cache: CacheFS: Add DocumentationDocumentation/filesystems/caching/cachefs.txt+375 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/12] FS-Cache: Generic filesystem caching facility

This series of patches does four things:

(1) Adds a generic intermediary (FS-Cache) by which filesystems may call on

     local caching capabilities, and by which local caching backends may make
     caches available:

	+---------+
	|         |                        +-----------+
	|   NFS   |--+                     |           |
	|         |  |                 +-->|  CacheFS  |
	+---------+  |   +----------+  |   | /dev/hda5 |
	             |   |          |  |   +-----------+
	+---------+  +-->|          |  |
	|         |      |          |--+   +-------------+
	|   AFS   |----->| FS-Cache |      |             |
	|         |      |          |----->| Cache Files |
	+---------+  +-->|          |      | /var/cache  |
	             |   |          |--+   +-------------+
	+---------+  |   +----------+  |
	|         |  |                 |   +-------------+
	|  ISOFS  |--+                 |   |             |
	|         |                    +-->| ReiserCache |
	+---------+                        | /           |
	                                   +-------------+

(2) Adds a quasi-filesystem (CacheFS) that can turn block devices into a local caches.

(3) Modifies the kAFS network filesystem to be able to read through this cache.

(4) Documents the netfs interface and the cache backend interface.

Other backends may be added to the system, and other netfs's may be modified to use caching.

There are a number of reasons why I'm not using i_mapping to do this. These have been discussed a lot on the LKML and CacheFS mailing lists, but to summarise the basics:

(1) Most filesystems don't do hole reportage. Holes in files are treated as blocks of zeros and can't be distinguished otherwise, making it difficult to distinguish blocks that have been read from the network and cached from those that haven't.

(2) The backing inode must be fully populated before being exposed to userspace through the main inode because the VM/VFS goes directly to the backing inode and does not interrogate the front inode on VM ops.

Therefore:

(a) The backing inode must fit entirely within the cache.

(b) All backed files currently open must fit entirely within the cache at the same time.

(c) A working set of files in total larger than the cache may not be cached.

(d) A file may not grow larger than the available space in the cache.

(e) A file that's open and cached, and remotely grows larger than the cache is potentially stuffed.

(3) Writes go to the backing filesystem, and can only be transferred to the network when the file is closed.

(4) There's no record of what changes have been made, so the whole file must be written back.

(5) The pages belong to the backing filesystem, and all metadata associated with that page are relevant only to the backing filesystem, and not anything stacked atop it.

David