HAMMER VFS - Implement swapcache for HAMMER data in double_buffer mode
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 3 Apr 2011 00:16:15 +0000 (17:16 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 3 Apr 2011 00:16:15 +0000 (17:16 -0700)
commit18bee4a2762368921be967944760f01b314b01fd
treeac87982ea47dc329732781fd998ca2a8f993b6f1
parent17c8b5ef529fed8bd69490fcb86293655ba693cf
HAMMER VFS - Implement swapcache for HAMMER data in double_buffer mode

* Support swapcache data caching when HAMMER's double_buffer mode is enabled.
  Typically the following sysctls:

  vfs.hammer.double_buffer=1
  vm.swapcache.read_enable=1
  vm.swapcache.data_enable=1
  vm.swapcache.meta_enable=1 (optional)
  vm.swapcache.use_chflags=0 (optional - see man swapcache)

* This causes swapcache to attempt to cache file data from HAMMER
  filesystems stored via the block device instead of the individual
  file vnodes.

* This allows swapcache to more efficiently cache file data without
  vnode recycling from a limited kern.maxvnodes value getting in the way.

  If you have a large dataset spread across many smaller files which would
  normally overwhelm maxvnodes, and even on large systems handling very
  large data sets where you wish to cache the file data for some of the
  files (using use_chflags=1 mode), this makes it possible to cache ALL
  the file data AND meta-data on the SSD even though the related vnodes
  cached by the kernel get recycled.

* Whereas it may have been inefficient to turn on vm.swapcache.data_enable
  before, due to filesystem scans and such, it may now be possible to this
  feature on with double buffering also enabled.

  Note that you must still be cognizant of the aggregate amount of file
  data being accessed by your system if you have set use_chflags to 0, you
  simply no longer need to worry about how many files that data belongs to.

* Enabling HAMMER's double_buffer mode will reduce performance somewhat for
  the normal best-case file caching, but it will also greatly improve
  performance once you start blowing out your memory caches.
sys/vfs/hammer/hammer_btree.c
sys/vfs/hammer/hammer_cursor.h
sys/vfs/hammer/hammer_object.c
sys/vfs/hammer/hammer_reblock.c
sys/vfs/hammer/hammer_vnops.c