git: DragonFly_RELEASE_5_4 hammer2 - refactor filesystem sync 2/N

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Dec 17 13:55:52 PST 2018


commit 76a438602ca422d7001d29017113476620be6a41
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Nov 8 17:10:07 2018 -0800

    hammer2 - refactor filesystem sync 2/N
    
    * Flesh out the flush partitioning code, fixing a number of issues.
    
    * Refactor hammer2_inode_lock() and add hammer2_inode_lock4() to
      interlock against flushes.  This is handled by blocking inode locks
      against SYNCQ, and reordering the inode to the front of the SYNCQ list
      in order to unblock as quickly as possible as the filesystem sync
      progresses.  The result should be relatively few frontend stalls
      during a filesystem sync.
    
    * Disable resource caps for the moment, because synchronous
      operations to prevent resource limits from blowing out break
      the current inode_lock*() code and allow vnode deadlocks to
      occur.
    
    * To avoid deadlocks, the filesystem sync currently must clear SYNCQ
      before locking the inode & vnode, and if it cannot lock a vnode it
      must continue on with the next inode and then restart.  Retried
      vnodes introduce a short delay to give the frontend time to work
      the blocking operation.
    
      This is necessary because the kernel locks vnodes before entering the
      H2 frontend, and we cannot safely unlock/relock them to work around
      this.  Nor do we necessarily even have full knowledge on which vnodes
      the current thread has locked.
    
    * Does not yet guarantee complete filesystem consistency on-crash.

Summary of changes:
 sys/vfs/hammer2/hammer2.h          |  40 +++-
 sys/vfs/hammer2/hammer2_admin.c    |   2 +
 sys/vfs/hammer2/hammer2_chain.c    | 305 +++++++++++++++++----------
 sys/vfs/hammer2/hammer2_flush.c    | 412 ++++++++++++++++---------------------
 sys/vfs/hammer2/hammer2_freemap.c  |   8 +-
 sys/vfs/hammer2/hammer2_inode.c    | 230 ++++++++++++++++-----
 sys/vfs/hammer2/hammer2_ioctl.c    |  22 +-
 sys/vfs/hammer2/hammer2_strategy.c |   5 +-
 sys/vfs/hammer2/hammer2_synchro.c  |   4 +-
 sys/vfs/hammer2/hammer2_vfsops.c   | 306 ++++++++++++++-------------
 sys/vfs/hammer2/hammer2_vnops.c    |  71 ++++---
 sys/vfs/hammer2/hammer2_xops.c     | 211 +++++++++++++++++--
 12 files changed, 996 insertions(+), 620 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/76a438602ca422d7001d29017113476620be6a41


-- 
DragonFly BSD source repository



More information about the Commits mailing list