collie/node: correct md info output

We actually return 'Free' instead of 'Size'

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: rename bs_thread_request_done() -> worker_thread_request_done()

The prefix "bs_" of the name bs_thread_request_done() would've come
from the naming scheme of tgt (the "backing store"). This prefix is
unclear so this patch rename it.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
md: purge directory only when md_add_disk() succeed

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests/057: fix 057 and 057.out

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
cluster/local: don't process leave event of gateway node

We must not call sd_leave_handler() when the gateway node leaves cluster.  It is
because we already processed the event when the node became gateway.

The local driver can pass tests/048 with this patch.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[don't merge] tests: valgrind option for lower memory machine

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[tmp] tests: don't use /dev/urandom for better performance

/dev/urandom is too slow.  We don't need good random values to fill vdis.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: check whether there is a pending recovery correctly

Comparing current_rinfo->epoch and sys->epoch is not enough because sheep may
start recovery without incrementing sys->epoch (e.g. unplugging a md disk).
Checking next_rinfo is correct and more straightforward.

This fixes an error of tests/056.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[tmp] work: reduce global variables

- make worker_info_list a static variable

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
work: rename init_wqueue_eventfd and init_work_queue

init_wqueue_eventfd() is not good as a global name because all the work queue
users don't have to know that the work queue uses eventfd.  This renames
init_wqueue_eventfd() to init_work_queue(), and init_work_queue() to
create_work_queue().

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
work: remove sheep_priv.h from include files

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
work: remove trace.h from include files

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
move work queue codes from sheep to lib

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[tmp] collie: add primitive

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: add operation to get object sha1 digest

Currently, we compare entire object contents to check whether there is no
difference among them.  However, this wastes a lot of network bandwidth and some
operations like vdi check or object recovery take too long time to complete.

This adds an operation SD_OP_GET_HASH to get the sha1 digest of the object, and
enables us to do faster vdi check and recovery.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
collie: use hash for collie check

This patch checks the hash values of the target objects and skips check and
repair when there is no difference between them.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: recover from local when target node has same content

This checks the hash value of the target object before reading the entire data,
and recovers from local if there is a same object in the stale directory.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
[tmp] collie: use wq for hash

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>