hammer2 - Fix bulkfree bugs
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 19 Aug 2017 05:36:23 +0000 (22:36 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 19 Aug 2017 05:36:23 +0000 (22:36 -0700)
commitfae225dce61daa160e17d4cbdace35108ad1ed6f
treed2f974f8990af90d7ff5623926440fbc1c41d063
parent9dca9515d47eeb36c9696bb04c0112bafd8efe38
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
  concurrency.

* 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.
sys/vfs/hammer2/hammer2.h
sys/vfs/hammer2/hammer2_bulkfree.c
sys/vfs/hammer2/hammer2_flush.c
test/debug/h2chains.c [new file with mode: 0644]