git: hammer2 - Refactor cluster locks, syncthr fixes, cleanups

Matthew Dillon dillon at
Sun May 24 20:30:59 PDT 2015

commit a6cf10526d880794bcafaf2ee483da7090abe79e
Author: Matthew Dillon <dillon at>
Date:   Sun May 24 20:20:39 2015 -0700

    hammer2 - Refactor cluster locks, syncthr fixes, cleanups
    * Do not resolve the cluster when locking and unlocking.  This led to
      problems when cparents used in iterations were being temporarily unlocked,
      because their nodes represent the iteration in the physical topology
      so the resolve might fail when relocked.
      Instead, resolution occurs with all cluster creation mechanics.  So, e.g.
      hammer2_cluster_lookup() and hammer2_cluster_next() will resolve the
      cluster being returned.
    * Change hammer2_cluster_copy() semantics to inherit focus state and not
      call hammer2_cluster_resolve(), for the same reason as above.
    * A cluster iteration usually returns NULL when the focus is lost, e.g.
      when only unsynchronized slaves remain.  Add a flag so the sync thread
      can iterate the cluster until all nodes are exhausted.
    * Cleanup focus handling for the cluster iterator.  Move the bref compare
      to the resolver and get rid of the manual compare code in the iterator.
    * Fix a locking flags bug in the cluster iterator.
    * Fix numerous deadlocks.  Mostly requires unlocking the whole cluster before
      looping the iterator for new elements, so later indexes are not held locked
      while working on earlier indexes.
    * Fix numerous issues in syncthr, in particular only repoint the index
      of the cluster the syncthr is managing when updating the inode to avoid
      clashes with inode updates from other syncthrs.
    * Change the way HAMMER2_CITEM_INVALID works in syncthr so we can be
      more hard-nosed about it in the cluster iterator.  Generally speaking
      we clear the INVALID bit when synchronizing a new element, even if it is
      a recursion and modify_tid cannot be immediately set.

Summary of changes:
 sys/vfs/hammer2/TODO               |   1 -
 sys/vfs/hammer2/hammer2.h          |  13 +-
 sys/vfs/hammer2/hammer2_bulkscan.c |   2 +
 sys/vfs/hammer2/hammer2_chain.c    |  29 ++-
 sys/vfs/hammer2/hammer2_cluster.c  | 374 +++++++++++++++++++------------------
 sys/vfs/hammer2/hammer2_flush.c    |  10 +-
 sys/vfs/hammer2/hammer2_inode.c    |  61 +++++-
 sys/vfs/hammer2/hammer2_syncthr.c  | 116 +++++++++---
 8 files changed, 382 insertions(+), 224 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list