From c5bafae6fd10282f408695c7763b1277469123f6 Mon Sep 17 00:00:00 2001 From: Ma Jianpeng Date: Tue, 9 Sep 2014 18:15:53 +0800 Subject: [PATCH] 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 --- .../erasure-code/ceph_erasure_code_benchmark.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/erasure-code/ceph_erasure_code_benchmark.cc b/src/test/erasure-code/ceph_erasure_code_benchmark.cc index 14c275069aa2e..008e4331abb15 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')); -- 2.47.3