git: kernel - Refactor vfs_cache 4/N

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Mar 2 17:29:12 PST 2020


commit 377c06c29cd595c7b8112502da809b981775f531
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Mar 2 17:11:35 2020 -0800

    kernel - Refactor vfs_cache 4/N
    
    * Refactor cache_findmount() to operate conflict-free and cache line
      bounce free for the most part.  The counter trick is used to probe
      cache entries and combined with a local pcpu spinlock to interlock
      against unmounts.
    
      The umount code is now a bit more expensive (it has to acquire all
      pcpu umount spinlocks before cleaning the cache out).
    
      This code is not ideal but it performs up to 6x better on multple cpus.
    
    * Refactor _cache_mntref() to use a 4-way set association.
    
    * Rewrite cache_copy() and cache_drop_and_cache()'s caching algorithm.
    
    * Use cache_dvpref() from nlookup() instead of rolling the code twice.
    
    * Rewrite the nlookup*() and cache_nlookup*() code to generally leave
      namecache records unlocked throughout, removing one layer of shared
      locks from cpu contention.  Only the last element is locked.
    
    * Refactor nlookup*()'s handling of absolute paths a bit more.
    
    * Refactor nlookup*()'s handling of NLC_REFDVP to better-validate
      that the parent directory is actually the parent directory.
    
      This also necessitates a nlookupdata.nl_dvp check in various system
      calls using NLC_REFDVP to detect the mount-point case and return
      the proper error code (usually EINVAL, but e.g. mkdir would return
      EEXIST).
    
    * Clean up _cache_lock() and friends to restore the diagnostic messages
      when a namecache lock stalls for too long.
    
    * FIX: Fix bugs in nlookup*() retry code.  The retry code was not properly
      unwinding symlink path construction during the loop and also not properly
      resetting the base directory when looping up.  This primarily effects NFS.
    
    * NOTE: Using iscsi_crc32() at the moment to get a good hash distribution.
      This is obviously expensive, but at least it is per-cpu.
    
    * NOTE: The cache_nlookup() nchpp cache still has a shared spin-lock
      that will cache-line-bounce concurrent aquisitions.

Summary of changes:
 sys/kern/vfs_cache.c    | 809 +++++++++++++++++++++++++++++++-----------------
 sys/kern/vfs_nlookup.c  | 484 +++++++++++++++++++----------
 sys/kern/vfs_syscalls.c |  26 +-
 sys/sys/namecache.h     |  15 +-
 sys/sys/nlookup.h       |   8 +-
 sys/sys/spinlock2.h     |   9 +
 6 files changed, 886 insertions(+), 465 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/377c06c29cd595c7b8112502da809b981775f531


-- 
DragonFly BSD source repository



More information about the Commits mailing list