git: hammer2 - Fix bulkfree bug, Fix chain->parent bug, refactor dedup a bit

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Aug 26 22:22:17 PDT 2017


commit b49f72c388b8abdc9d74fa508d5dddf2ee0d6c6e
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat Aug 26 21:56:14 2017 -0700

    hammer2 - Fix bulkfree bug, Fix chain->parent bug, refactor dedup a bit
    
    * Fix a bulkfree bug where live->linear was being calculated using
      HAMMER2_FREEMAP_BLOCK_SIZE instead of HAMMER2_BMAP_INDEX_SIZE.
      This calculation was still block-size-aligned and couldn't cause
      any damage.  However, the conditional itself was in error and
      could prevent bulkfree from correcting an unaligned live->linear
      value.
    
      The new code unconditoinally corrects live->linear for now.
      Bulkfree doesn't collect sufficiently fine-grained data to set
      it properly.
    
    * bulkfree now also requires live->linear to be reasonable when deciding
      to skip bitmaps.
    
    * hammer2_chain_modify() needs to know when a dedup has been registered
      for a (data) block.  We previously cleared the CHAIN_MODIFIED bit to
      force a reallocation, but doing so interferes with the flush code
      (even though UPDATE remains set).
    
      Fix this by adding a chain flag.  Also properly set the flag only if
      a dedup has actually been registered, and properly clear the flag once
      the underlying storage has been reallocated.
    
    * Refactor hammer2_chain_getparent() and add hammer2_chain_repparent().
      Have these functions deal with all chain->parent race conditions
      themselves.
    
      This fixes a race condition in two places, most importantly in
      hammer2_xop_nrename() (albeit limited to directory-embedded inodes,
      which would only be the super-root entries).
    
    * Do a better job protecting the chain->parent field.  Require that
      chain->core.spin be held for field modifications in addition to
      parent->core.spin.  This fixes a race against hammer2_chain_setflush()
      that could cause the flush code to miss chains.
    
    * Disable TIMER() debugging for now.

Summary of changes:
 sys/vfs/hammer2/hammer2.h          |   5 +-
 sys/vfs/hammer2/hammer2_bulkfree.c |  99 ++++++++++------
 sys/vfs/hammer2/hammer2_chain.c    | 236 ++++++++++++++++++++-----------------
 sys/vfs/hammer2/hammer2_freemap.c  |   4 +-
 sys/vfs/hammer2/hammer2_inode.c    |  27 +----
 sys/vfs/hammer2/hammer2_strategy.c |  25 ++--
 sys/vfs/hammer2/hammer2_xops.c     |  15 +--
 7 files changed, 216 insertions(+), 195 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/b49f72c388b8abdc9d74fa508d5dddf2ee0d6c6e


-- 
DragonFly BSD source repository



More information about the Commits mailing list