optimize fnv hash

FNV hash author says that a expression of shifts and adds is faster
than FNV_prime multiply (*).  However, with the recent GCC and
hardware, it looks like the FNV_prime multiply generates much faster
code.

This patch uses FNV_64_PRIME to generate codes, and adds fnv_64a_64 to
create a hash value from 64 bit integers faster.  Note that this patch
is just for optimization and will not change the generated hash
values.

(*) http://www.isthe.com/chongo/tech/comp/fnv/#gcc-O3

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
add sd_hash to generate more dispersed hash values

I noticed that adding one more fnv_64a calculation like

  hval = fnv_64a_64(hval, hval)

generates much more dispersed hash values.

This patch introduces sd_hash(), which does the above calculation
before returning the result.  This also add sd_hash_next(), which is
intended to be used for virtual nodes and virtual disks.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep: use sd_hash instead of fnv_64a_buf

This patch uses sd_hash instead of fnv_64a_buf for better object
dispersion.

This also fixes the problem that we are using the number of disks for
calculating virtual disk ids.  Without this patch, virtual disk ids of
the existing disks will be changed for each we plug/unplug a disk; a
lot of object movement will happen.

Please note that this patch breaks backward compatibility because this
changes a hash function of our consistent hashing algorithm, which
means that object location will be also changed.  The upgrade code for
the existing users will be appeared before releasing the next sheepdog
release.

I've not changed some hash calculation which is used for getting
object file names (vdi object name and attribute object name).  It is
because changing them makes it very hard to implement the upgrade code
and forces us to modify qemu client codes too.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
increase the default number of virtual nodes

We gave up backward compatibility in the previous patch, so it's a
good chance to increase the default number of virtual nodes.

The number means the default granularity of how much data will be
moved after node change events.  E.g., if the number of virtual nodes
is 5, at least one-fifth data will be moved when object movement
happens.

There is no good rational reason for the number 128.  The bigger
number requires more memory space.  I've chose it just because it's
the same number as the current default virtual disks.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep: update store version

There is no compatibility after changing a hash function for the
consistent hash ring.

The upgrade code is not implemented yet.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
tests/functional: update tests for new hash function

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
test/unit: add test to check hash function

This unittest checks

 - the existing virtual node ids after node join/leave events.
 - the existing virtual disk ids after disk plug/unplug events.
 - dispersion of sd_hash() with a chi-squared test.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>