hammer2 - Retool flushing and use of mirror_tid, more cluster work.
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 8 Apr 2015 05:53:06 +0000 (22:53 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 8 Apr 2015 06:25:27 +0000 (23:25 -0700)
commite513e77e7d72a7b81fe5a8e60f5d9511e10af682
tree8ffaa6ac595ed7fd78544b7a9c0c5c5de8386a9d
parente99c31a32aa329b9126f558c272dd36fa10be64d
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
  mirror_tid.

* 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
  fixes.

  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.
14 files changed:
sys/vfs/hammer2/DESIGN
sys/vfs/hammer2/TODO
sys/vfs/hammer2/hammer2.h
sys/vfs/hammer2/hammer2_bulkscan.c
sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_cluster.c
sys/vfs/hammer2/hammer2_disk.h
sys/vfs/hammer2/hammer2_flush.c
sys/vfs/hammer2/hammer2_freemap.c
sys/vfs/hammer2/hammer2_inode.c
sys/vfs/hammer2/hammer2_ioctl.c
sys/vfs/hammer2/hammer2_syncthr.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/hammer2/hammer2_vnops.c