From: Ma Jianpeng Date: Tue, 9 Sep 2014 10:15:53 +0000 (+0800) Subject: erasure-code: Avoid k/m that we set are not equal in erasure-plugin. X-Git-Tag: v0.86~117^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2305%2Fhead;p=ceph.git erasure-code: Avoid k/m that we set are not equal in erasure-plugin. Because erasure-plugin has default k/m and can autotune if k or m invalid. Check k/m they are the same as we want. Signed-off-by: Ma Jianpeng --- diff --git a/src/test/erasure-code/ceph_erasure_code_benchmark.cc b/src/test/erasure-code/ceph_erasure_code_benchmark.cc index 14c275069aa..008e4331abb 100644 --- a/src/test/erasure-code/ceph_erasure_code_benchmark.cc +++ b/src/test/erasure-code/ceph_erasure_code_benchmark.cc @@ -130,6 +130,15 @@ int ErasureCodeBench::encode() int k = atoi(parameters["k"].c_str()); int m = atoi(parameters["m"].c_str()); + if (erasure_code->get_data_chunk_count() != (unsigned int)k || + (erasure_code->get_chunk_count() - erasure_code->get_data_chunk_count() + != (unsigned int)m)) { + cout << "paramter k is " << k << "/m is " << m << ". But data chunk count is " + << erasure_code->get_data_chunk_count() <<"/parity chunk count is " + << erasure_code->get_chunk_count() - erasure_code->get_data_chunk_count() << endl; + return -EINVAL; + } + bufferlist in; in.append(string(in_size, 'X')); set want_to_encode; @@ -158,6 +167,14 @@ int ErasureCodeBench::decode() int k = atoi(parameters["k"].c_str()); int m = atoi(parameters["m"].c_str()); + if (erasure_code->get_data_chunk_count() != (unsigned int)k || + (erasure_code->get_chunk_count() - erasure_code->get_data_chunk_count() + != (unsigned int)m)) { + cout << "paramter k is " << k << "/m is " << m << ". But data chunk count is " + << erasure_code->get_data_chunk_count() <<"/parity chunk count is " + << erasure_code->get_chunk_count() - erasure_code->get_data_chunk_count() << endl; + return -EINVAL; + } bufferlist in; in.append(string(in_size, 'X'));