git: kernel - SWAP CACHE part 20/many - add 'cache' and 'noscache' chflags.

Matthew Dillon dillon at
Wed Feb 17 00:00:17 PST 2010

commit e9b560582904689977f992db6d5a91304b89ec4a
Author: Matthew Dillon <dillon at>
Date:   Tue Feb 16 23:52:14 2010 -0800

    kernel - SWAP CACHE part 20/many - add 'cache' and 'noscache' chflags.
    * Allow directory hierarchies to be selected for data caching when
      using vm.swapcache.data_enable.
    * Add the vm.swapcache.use_chflags sysctl which defaults to ON and
      enables use of the new chflags flags to determine what directory
      trees the swapcache will cache data from.
    * Add chflags cache and noscache.  The flags are tracked recursively
      by the namecache and do *NOT* have to be set recursively in the
      directory tree.  Setting a flag in a top-level directory is sufficient
      to cover the entire subtree.
      chflags cache -	Any regular file in the subtree will be cached
    			by swapcache.
      chflags noscache -	Disables any swapcacheing of data in the subtree,
    			overrides any use of chflags cache in the subtree.
      NOTE: Only applies to file data.  The caching of file meta-data by
      swapcache is controlled globally by vm.swapcache.meta_enable and
      ignores chflags flags..
    * Adjust the manual pages for swapcache and chflags.
    * NOTE! The default has been changed to require the use of chflags, data
      caching will not occur unless you either turn off the
      vm.swapcache.use_chflags sysctl (which enables data caching globally)
      or do something like 'chflags cache /'.  Of course vm.swapcache.read_enable
      must also be turned on for swapcache to cache file data.
    * NOTE! World must be rebuilt for libc, chflags, and ls to understand the
      new flags.

Summary of changes:
 lib/libc/gen/strtofflags.c |    7 +++++-
 share/man/man8/swapcache.8 |   46 ++++++++++++++++++++++++++++++++++++++++++-
 sys/kern/vfs_nlookup.c     |   42 ++++++++++++++++++++++++++++++++-------
 sys/kern/vfs_vnops.c       |   16 +++++++++++++++
 sys/sys/namecache.h        |    8 +++---
 sys/sys/nlookup.h          |    1 -
 sys/sys/stat.h             |    2 +
 sys/sys/vnode.h            |    3 +-
 sys/vm/vm_swapcache.c      |   23 +++++++++++++++++++--
 test/test/baaz             |    2 +
 usr.bin/chflags/chflags.1  |   39 ++++++++++++++++++++++++++++++++++++-
 11 files changed, 167 insertions(+), 22 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list