git: hammer2 - refactor filesystem sync 2/N

Matthew Dillon dillon at
Wed Dec 5 14:29:27 PST 2018

commit ecfe89b8868b30c9ddfa9c86cb4b0a20365a248d
Author: Matthew Dillon <dillon at>
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
    * 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(-)

DragonFly BSD source repository

More information about the Commits mailing list