- 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.
fae225d hammer2 - Fix bulkfree bugs
sys/vfs/hammer2/hammer2.h | 16 +++-
sys/vfs/hammer2/hammer2_bulkfree.c | 42 +++------
sys/vfs/hammer2/hammer2_flush.c | 145 +++++++++++++++++++------------
test/debug/h2chains.c | 171 +++++++++++++++++++++++++++++++++++++
4 files changed, 287 insertions(+), 87 deletions(-)