git: hammer2 - Fix bulkfree bugs

Matthew Dillon dillon at
Fri Aug 18 22:43:25 PDT 2017

commit fae225dce61daa160e17d4cbdace35108ad1ed6f
Author: Matthew Dillon <dillon at>
Date:   Fri Aug 18 22:36:23 2017 -0700

    hammer2 - Fix bulkfree bugs
    * Fix a bug where the HAMMER2_CHAIN_ONFLUSH flag could become desynchronized,
      preventing some modifications from chaining the flag to the root.
      This caused the bulkfree's flush to miss some chains and thus free
      blocks that should not have been freed.
      With this fix concurrent bulkfree and modifying operations appear to
      work properly.
    * For now do two quick flush passes in the bulkfree code.  We probably
      need only one.
      Note on the bulkfree code: This code operates by flushing currently
      modified chains and then taking a snapshot of the vchain blockmap.
      The bulkfree code can then operate on the snapshot concurrent with
      active filesystem operations, without interfering with or being
      interfered with by those operations.
      The bulkfree code does not have to flush modified in-memory inodes or
      buffer cache buffers, it need only flush modified hammer2_chain structures
      which may have done allocations, in order to properly account for those
      allocations.  Bulkfree runs in two stages precisely in order to allow
    * Adjust hammer2.h so userland kvm debugging programs can access it.
    * Add a debug program called h2chains.c which dumps the chain and
      checks flag consistency via kvm given a hammer2 hmp root address.

Summary of changes:
 sys/vfs/hammer2/hammer2.h              |  16 +++-
 sys/vfs/hammer2/hammer2_bulkfree.c     |  42 +++-------
 sys/vfs/hammer2/hammer2_flush.c        | 145 ++++++++++++++++++++-------------
 test/debug/{ksyscalls.c => h2chains.c} | 112 +++++++++++++++++--------
 4 files changed, 196 insertions(+), 119 deletions(-)
 copy test/debug/{ksyscalls.c => h2chains.c} (54%)

DragonFly BSD source repository

More information about the Commits mailing list