git: kernel - namecache MPSAFE work

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Dec 21 08:34:29 PST 2009


commit f63911bf7509f097d39a51a5b757e9c59f7efeb5
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Dec 21 08:15:18 2009 -0800

    kernel - namecache MPSAFE work
    
    * Most of the MPSAFE coding required for namecache operation.  The MP
      lock still surrounds this code.
    
    * Use a per-bucket spinlock for nchashtbl[] lookups.
    
    * Use a global spinlock for ncneglist.
    
    * Use a global token for nc_parent interlocks.
    
    * Use a per-vnode spinlock (v_spinlock == v_lock.lk_spinlock) to
      manage access to the v_namecache list.
    
    * Recode namecache locks to use atomic_cmpset_ptr() based around
      nc_locktd instead of nc_exlocks.  nc_exlocks is still used to
      track the exclusive lock count.
    
      NOTE: There may be an issue with the way nc_lockreq is handled.
    
    * Recode cache_hold/drop to use atomic_cmpset_int().
    
    * Carefully code cache_zap() for MPSAFEness.  In particular, multiple
      locks must be held before it can be determined that a namecache
      structure no longer has any referers.  Here is where having the global
      token is really useful.
    
    * cache_fullpath() and vn_fullpath() previously assumed the good graces
      of the MP lock and didn't bother holding refs on the namecache pointers
      they were traversing.  Now they do.
    
    * nlookup*() functions also previously made assumptions with regards
      to holding refs.  Now they properly hold refs.
    
    * struct namecache's nc_flag field is no longer modified outside of
      holding a lock on the structure, so we do not have to resort to
      atomic ops.

Summary of changes:
 sys/kern/vfs_cache.c   |  866 +++++++++++++++++++++++++++++++-----------------
 sys/kern/vfs_journal.c |   39 ++-
 sys/kern/vfs_mount.c   |    6 +-
 sys/kern/vfs_nlookup.c |   25 +-
 sys/kern/vfs_subr.c    |    5 +
 sys/sys/namecache.h    |   44 ++-
 sys/sys/vnode.h        |    7 +-
 7 files changed, 647 insertions(+), 345 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/f63911bf7509f097d39a51a5b757e9c59f7efeb5


-- 
DragonFly BSD source repository





More information about the Commits mailing list