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.