journal: remove using octal constant as the journal file permission

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
util: add BUILD_BUG_ON() for detecting errors at compile time

This patch adds BUILD_BUG_ON() to include/util.h. The macro can be
used for detecting errors which should cause build
error. e.g. checking struct sizes, etc.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
journal: use BUILD_BUG_ON() for checking the size of struct journal_descriptor

This patch adds BUILD_BUG_ON() for checking the size of struct
journal_descriptor. Even if the struct modified in wrong manners, the
BUILD_BUG_ON() can detect the invalid changes (on the size).

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
collie: use bit functions to traverse vdi list

This increases performance of vdi traversing.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: rename sheepdog_inode as sd_inode

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: remove nr_copies in {write, read, read_backend}_object

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: simply use 'list' instead of 'dw_siblings'

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: use switch case inside vdi_create()

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
recovery: fix incomplete recovery because of faulty oid scheduling

tests/010 will fail sometimes to catch this bug.

When auto-recover is disabled, if we prepare_schedule_oid on the same oid
multiple times, it will break finish_schedule_oid to wrongly squeeze some
victim oid out of rw->oids array, then this node will never have a chance to
recover the ejected oids.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Revert "test: collect logs of sheeps after tests"

We can pass all the tests in most cases, but this patch generates
log.* directory every time even if there is no errors.  In addition,
this collects log files only of the last test, and do nothing against
the other ones.

Rather than improving this half baked patch, let's revert it for now
and reconsider the best way to collect logs.  IMHO collecting log
files should be done outside of the test scripts, though.

This reverts commit 26cdf0dee923ad16989ed22436692272af1a071a.

Cc: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: use $* instead of $@

The behavior of $@ in double quotations depends on the environment.
Actually, './check -valgrind' doesn't work on Fedora 16.  It is safe
to use $@ instead of it.

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

With this patch, valgrind only prints error messages.

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

This prevents non-root users from running tests which need root
privilege.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: wait for sheep to be stopped

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: wait for sheep to be started

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: refine start up of valgrind sheep

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

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests/001: sleep before starting next sheep

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests: use different dir for each test case

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

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