git: hammer2 - Retool flushing and use of mirror_tid, more cluster work.

Matthew Dillon dillon at
Tue Apr 7 23:25:31 PDT 2015

commit e513e77e7d72a7b81fe5a8e60f5d9511e10af682
Author: Matthew Dillon <dillon at>
Date:   Tue Apr 7 22:53:06 2015 -0700

    hammer2 - Retool flushing and use of mirror_tid, more cluster work.
    Now that I'm starting to deal with different PFSs on the same physical
    volume some mirror_tid related issues need to be fixed.
    * mirror_tid is now per-media, not per-PFS.  This fixes a number of issues
      particularly with the on-mount recovery scan.  Mount, recovery, and flush
      code now no longer has to worry about PFSs when it comes to adjusting
    * modify_tid will become per-physical PFS (not quite done in this commit).
    * Change where mirror_tid gets set.  Set bref.mirror_tid in
      hammer2_chain_modify() instead of in the flush code.  This takes care
      of most of the flush cases.
    * Better separation of the freemap_tid in the volume header.
    * fchain (freemap) and vchain (main topology) syncing now works properly.
      The fchain can be flushed independently of vchain, and the recovery code
      can handle any number of vchain flushes occuring without a fchain flush.
      For the moment, both are flushed on sync, fchain first, vchain second.
      This can leave fchain's mirror_tid slightly behind vchain requiring
      recovery on mount if a crash were to occur.
      We now properly update just the fchain mirror_tid on a followup sync if
      no main topology modifications have occurred, allowing the fchain
      mirror_tid to catch-up to the vchain mirror_tid.
      We now properly sync the fchain on unmount so no recovery is required.
    * Revamp the recovery code to properly use the fchain-to-vchain mirror_tid
      range in the recovery scan.  This has the general effect of making the
      recovery pass run a whole lot faster and when coupled with the above
      Report whether recovery is needed or not on-mount and the mirror_tid range
      if so.
    * Update DESIGN.
    * Add CITEM_FEMOD indicating which chains in the hammer2_cluster structure
      can actually be modified and modsync'd by a hammer2_cluster_modify() call.
    * CITEM_INVALID now also checks bref.modify_tid as intended, when checking
      whether nodes are synchronized or not (it used to use mirror_tid but with
      the revamping modify_tid takes over this functionality).
    * Remove the auto-ref/auto-drop from hammer2_chain_lock(),
      hammer2_chain_unlock(), hammer2_cluster_lock(),
      and hammer2_cluster_unlock().  Separate ref and drop calls are needed if
      the ref-count is not taken care of already.
      This makes the *chain* and *cluster* API basically behave the same way,
      reducing confusion.
      Cleanup related #defines and code infrastructure that is no longer needed
      to handle RESOLVE_NOLOCK.
    * Fix a bug when LOOKUP_NOLOCK is used.  Do not assume LOOKUP_SHARED when
      LOOKUP_NOLOCK is used, use the LOOKUP_SHARED flag only to determine the
      locking type.  Otherwise relocking the parent (which has to be locked)
      for the degenerate DIRECTDATA case breaks the parent and causes a
      deadlock or assertion.
    * Preliminary adjustments to the slave synchronization code.  In particular,
      add support to hammer2_chain_modify() to suppress modify_tid updates so
      the slave synchronization code can update the field manually.  It must
      NOT update the modify_tid in parent chains in the topology until the
      sub-tree under them is synchronized.

Summary of changes:
 sys/vfs/hammer2/DESIGN             | 122 +++++++++++++++++++++-----
 sys/vfs/hammer2/TODO               |   5 ++
 sys/vfs/hammer2/hammer2.h          |  63 ++++----------
 sys/vfs/hammer2/hammer2_bulkscan.c |  19 +++--
 sys/vfs/hammer2/hammer2_chain.c    |  93 +++++++++++++-------
 sys/vfs/hammer2/hammer2_cluster.c  | 164 ++++++++++++++++++++++++-----------
 sys/vfs/hammer2/hammer2_disk.h     |  13 +--
 sys/vfs/hammer2/hammer2_flush.c    | 169 +++++++++++++++++--------------------
 sys/vfs/hammer2/hammer2_freemap.c  |  10 ++-
 sys/vfs/hammer2/hammer2_inode.c    |  51 ++++++++---
 sys/vfs/hammer2/hammer2_ioctl.c    |   4 +-
 sys/vfs/hammer2/hammer2_syncthr.c  | 139 +++++++++++++++++++++---------
 sys/vfs/hammer2/hammer2_vfsops.c   | 103 +++++++++++++++-------
 sys/vfs/hammer2/hammer2_vnops.c    |   8 +-
 14 files changed, 620 insertions(+), 343 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list