include: add Spinlock

Signed-off-by: Sage Weil <sage@inktank.com>
common/buffer: cache crcs in buffer::raw

Signed-off-by: Samuel Just <sam.just@inktank.com>
common/buffer: instrument utilization of cached crcs

This is similar to the alloc tracking, but I've added a method to let
you enable it easily (in this case, from the unit test).

Signed-off-by: Sage Weil <sage@inktank.com>
common/buffer: add crc caching performance test

On my old box:
 - matching cached values is a big win (free), obviously
 - the adjustment is the same speed as redoing the calculation.  this
   is probably because the data is already in L1/L2 cache; we still
   save memory bandwidth.

Signed-off-by: Sage Weil <sage@inktank.com>
common/buffer: explicitly init zbuf to zeros

This might not be necessary?

Signed-off-by: Sage Weil <sage@inktank.com>
common/sctp_crc32: accept NULL buffer pointer

If we get NULL we behave as if it were a zero-filled buffer.

Signed-off-by: Sage Weil <sage@inktank.com>
common/crc32c_intel_baseline: accept null data buffer

Signed-off-by: Sage Weil <sage@inktank.com>
common/crc32c: document interface

Signed-off-by: Sage Weil <sage@inktank.com>
common/buffer: pass NULL buffer instead of a zero-filled one

This is about 2x faster on my box using the sctp code.

Signed-off-by: Sage Weil <sage@inktank.com>
crc32c: add a special case crc32c NULL buffer handling

Adding a special case crc32c NULL buffer handling for the intel assembly
code.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
sctp_crc32c: fix crc calculation in the NULL buffer case

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
crc32c: expand unit test

Verify crc on a buffer range, and on a NULL buffer (with various
sizes).

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/buffer: behave when cached crc stats don't start at 0

In particular, this helps when we set CEPH_BUFFER_TRACK=true

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

buffer: cache crc values in buffer::raw

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>