hammer2 - Fix freemap bugs
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 6 Aug 2013 05:50:51 +0000 (22:50 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 6 Aug 2013 06:03:53 +0000 (23:03 -0700)
commit2c6f594d1626814a7ddaa371c7c02f3c2cd60c74
tree9c494c03b97c167eb096ece2a2f430a7c39bc8ab
parent9ec04660b16df3250d2d586500f1da48c005d85c
hammer2 - Fix freemap bugs

* The linear iterator must not be used if aligned on an allocation
  chunk (16K) boundary.  Reserved areas just set the bitmap to all 1's
  but were leaving the iterator set to 0.  Fix both the boundary check
  and initialized bmap->linear for reserved areas to HAMMER2_SEGSIZE.

  This fixes a corruption issue where allocates were being made out of
  reserved areas and then overwritten by e.g. the freemap, and where
  the linear iterator would reallocate areas already allocated via the
  bitmap.

* Fix the code which marks device bufferse B_CACHE when freshly allocated.
  It wasn't handling the 32KB case properly.

* Our pre-caching gets and releases a block.  B_CACHE must be used in addition
  to calling vfs_bio_clrbuf() because we aren't holding onto the locked buffer.
sys/vfs/hammer2/hammer2_freemap.c