sys/vfs/hammer: Fix/rewrite hammer_free_freemap()
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fri, 11 Mar 2016 14:49:15 +0000 (23:49 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sat, 19 Mar 2016 19:50:09 +0000 (04:50 +0900)
commitde75bb26d7216c20f9ddfe67784f7dce051bd11c
tree31a86f51cff486339b0a65def511c49a5836dee4
parentd8d66807e699a65a818da70373fc7447ba3095d5
sys/vfs/hammer: Fix/rewrite hammer_free_freemap()

This commit rewrites hammer_free_freemap() used by hammer volume-del
in order to handle layer2 layout change by the previous commit.

The functional difference (other than the layout difference) is
that this commit through for-loop twice. This is to separate
counting busy layer2 and zero clearing layer1. Layer1 zero clear
should be done only when all layer2 are empty, so no ondisk change
occurs until it's ready to erase ondisk layer1. It previously had
these two in the same loop, which means if the volume consisted
of >1 layer1 it could happen to find out the volume wasn't ready
to remove after it has zero cleared layer1 entry(s).

This commit adds prototype for hammer_iterate_l1l2_entries().
This was added only to avoid compile error for not using it.
hammer_iterate_l1l2_entries() will be removed in the next commit.
(Removing it in this same commit makes default git diff without
any option unclear)

This commit does not affect a volume that was previously added
by hammer volume-add when removing that volume via hammer volume-del
after this commit. HAMMER reads layer2 offset from ondisk layer1
entries (and layer1 layout hasn't changed), so the change made by
the previous commit to conform to the original design doesn't
depend on the code once it's added.
sys/vfs/hammer/hammer_volume.c