]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: Avoid k/m that we set are not equal in erasure-plugin. 2305/head
authorMa Jianpeng <jianpeng.ma@intel.com>
Tue, 9 Sep 2014 10:15:53 +0000 (18:15 +0800)
committerMa Jianpeng <jianpeng.ma@intel.com>
Tue, 9 Sep 2014 10:15:53 +0000 (18:15 +0800)
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 <jianpeng.ma@intel.com>
src/test/erasure-code/ceph_erasure_code_benchmark.cc

index 14c275069aa2e7ae3c2ddee5cdee11e21f5c03d0..008e4331abb15b11d9e301aeb136c9eed7cf90ef 100644 (file)
@@ -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<int> 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'));