erasure: make ec_helpers more generic

This will allow us to pass dynamic data and parity combination to make different
erasure coding possible.

At most we support 7 parity strip, which means we can stand with 7 nodes failure
at the same time.

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

usage:
$ dog vdi create -c x:y test 10g # create a erasured vdi

x represent number of data strips and y number of parity strips

x can be 2, 4, 8, 16 , 0 < y < 8 and x > y

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
tests/func: add a dedicated test for recovery of erasure code

Current master can't pass it and this bug will be fixed by next patch.

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
lib/fec: fix decode_prepare()

We should skip the null element from 'dp'. This fixes the problem that found
by tests/functional/076

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
dog: implement vdi check for erasure coded vdi

When data copy is missing, this command will rebuild it.

For the case that data get inconsistent but still accessable, we just print
inconsistent warning because it is kind of hard to handle it and leave it
as a future work

Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
erasure: add ec_decode_buffer() helper

Since there are multiple places tries to decode the whole object, it is nice to
have a helper function to do it.

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