common/bloom_filter: make compressible_bloom_filter encodable

Signed-off-by: Sage Weil <sage@inktank.com>
common/bloom_filter: drop raw_table_size_ member

We were storing table_size_ and raw_table_size_, where one is the size in
bits and the other is the size in bytes.  This is silly.  Store only the
size in bytes.

Also, bytes are always 8 bits, so use bit shifts and drop some of that
silliness too.

Move the member declarations to the top of the class so you read them
before the methods.

Fix some annoying whitespace.

Avoid allocating a 0-length array.

Mark the encoding incompatible with v1.

Signed-off-by: Sage Weil <sage@inktank.com>
common/bloom_filter: remember original target size

This isn't strictly needed for core functionality, but it is convenient to
know.

Signed-off-by: Sage Weil <sage@inktank.com>
common/bloom_filter: methods for density, approx unique element counts

Signed-off-by: Sage Weil <sage@inktank.com>
common/bloom_filter: fix estimated element count for compressed filters

We need to compensate for the fact that there are fewer bits than there
used to be.

This is a crappy adjustment; it is non-linear.  It's clone enough for now,
though.

Signed-off-by: Sage Weil <sage@inktank.com>
common/bloom_filter: fix compress; improve argument

Fix bug in compress() when compressing to less than .5 or original.

Make the argument have sane units (target size relative to current size;
not a precentage reduction).

Signed-off-by: Sage Weil <sage@inktank.com>
common/bloom_filter: simplify compressible_bloom_filter encode/decode/dump

Re-use bloom_filter for this, as per Loic's suggestion.  Much nicer!

Signed-off-by: Sage Weil <sage@inktank.com>
common/bloom_filter: add a few assertions and checks for bit_table_ == NULL

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #693 from ceph/wip-bloom

bloom_filter improvements, cleanups

Reviewed-by: Loic Dachary <loic@dachary.org>