Skip to contentSkip to conversation

Split general cache manager from CacheFS

PATCH New David Howells 1 participant 1 message Oct 6, 2004

Subsystems (2)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/4 Split general cache manager from CacheFS

The attached patch splits the generic part of CacheFS out as FS-Cache - a general cache manager.

FS-Cache now mediates between cache backends (such as CacheFS) and network filesystems:

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

This will allow cache backends other than CacheFS to be added to the system without any need to change the netfs's that use FS-Cache.

---

warthog>diffstat fscache-269rc3mm2.diff

 fs/Kconfig                    |   15 
 fs/Makefile                   |    1 
 fs/fscache/Makefile           |   13 
 fs/fscache/cookie.c           |  973 ++++++++++++++++++++++++++++++++++++++++++
 fs/fscache/fscache-int.h      |   81 +++
 fs/fscache/fsdef.c            |   90 +++
 fs/fscache/main.c             |  111 ++++
 fs/fscache/page.c             |  231 +++++++++
 include/linux/fscache-cache.h |  205 ++++++++
 include/linux/fscache.h       |  357 +++++++++++++++
 10 files changed, 2075 insertions(+), 2 deletions(-)
fs/Kconfig +13 -2
diff -uNrp linux-2.6.9-rc3-mm2/fs/Kconfig linux-2.6.9-rc3-mm2-fscache/fs/Kconfig
@@ -485,10 +485,21 @@ config AUTOFS4_FS
 
 menu "Caches"
 
-config CACHEFS
-	tristate "Filesystem caching support"
+config FSCACHE
+	tristate "General filesystem cache manager"
 	depends on EXPERIMENTAL
 	help
+	  This option enables a generic filesystem caching manager that can be
+	  used by various network and other filesystems to cache data
+	  locally. Diffent sorts of caches can be plugged in, depending on the
+	  resources available.
+
+	  See Documentation/filesystems/fscache.txt for more information.
+
+config CACHEFS
+	tristate "Filesystem caching filesystem"
+	depends on FSCACHE
+	help
 	  This filesystem acts as a cache for other filesystems - primarily
 	  networking filesystems - rather than thus allowing fast local disc to
 	  enhance the speed of slower devices.
fs/Makefile +1 -0
diff -uNrp linux-2.6.9-rc3-mm2/fs/Makefile linux-2.6.9-rc3-mm2-fscache/fs/Makefile
@@ -45,6 +45,7 @@ obj-y				+= devpts/
 obj-$(CONFIG_PROFILING)		+= dcookies.o
  
 # Do not add any filesystems before this line
+obj-$(CONFIG_FSCACHE)		+= fscache/
 obj-$(CONFIG_REISERFS_FS)	+= reiserfs/
 obj-$(CONFIG_REISER4_FS)	+= reiser4/
 obj-$(CONFIG_EXT3_FS)		+= ext3/ # Before ext2 so root fs can be ext3
include/linux/fscache-cache.h +205 -0

205 lines not on this page · raw message

include/linux/fscache.h +357 -0

357 lines not on this page · raw message

fs/fscache/cookie.c +973 -0

973 lines not on this page · raw message

fs/fscache/fscache-int.h +81 -0

81 lines not on this page · raw message

fs/fscache/fsdef.c +90 -0

90 lines not on this page · raw message

fs/fscache/main.c +111 -0

111 lines not on this page · raw message

fs/fscache/Makefile +13 -0
diff -uNrp linux-2.6.9-rc3-mm2/fs/fscache/Makefile linux-2.6.9-rc3-mm2-fscache/fs/fscache/Makefile
@@ -0,0 +1,13 @@
+#
+# Makefile for general filesystem caching code
+#
+
+#CFLAGS += -finstrument-functions
+
+fscache-objs := \
+	cookie.o \
+	fsdef.o \
+	main.o \
+	page.o
+
+obj-$(CONFIG_FSCACHE) := fscache.o
fs/fscache/page.c +231 -0

231 lines not on this page · raw message