]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
erasure-code: fixing bugs in clay-code plugin
authorMyna V <mynaramana@gmail.com>
Wed, 17 Oct 2018 04:31:22 +0000 (10:01 +0530)
committerMyna V <mynaramana@gmail.com>
Wed, 17 Oct 2018 13:05:07 +0000 (18:35 +0530)
* Fixes alignment issue while using clay code with jerasure, cauchy_orig
* Fixes ceph_erasure_code_non_regression to adapt to new decode

Signed-off-by: Myna <mynaramana@gmail.com>
src/erasure-code/clay/ErasureCodeClay.cc
src/erasure-code/clay/ErasureCodeClay.h
src/test/erasure-code/TestErasureCodeClay.cc
src/test/erasure-code/ceph_erasure_code_non_regression.cc

index d4b24b078b4e0b98c89ed5fbf3ec0e7a497ab167..3f050c38d1295cd25d904394f3b4c36afa5f3f0c 100644 (file)
@@ -89,13 +89,10 @@ int ErasureCodeClay::init(ErasureCodeProfile &profile,
 
 unsigned int ErasureCodeClay::get_chunk_size(unsigned int object_size) const
 {
-  unsigned alignment = get_alignment();
-  unsigned tail = object_size % alignment;
-  unsigned padded_length = object_size + ( tail ?  ( alignment - tail ) : 0 );
-
-  ceph_assert(padded_length % (k*sub_chunk_no) == 0);
-
-  return padded_length / k;
+  unsigned int alignment_scalar_code = pft.erasure_code->get_chunk_size(1);
+  unsigned int alignment = sub_chunk_no * k * alignment_scalar_code;
+  
+  return round_up_to(object_size, alignment) / k;
 }
 
 int ErasureCodeClay::minimum_to_decode(const set<int> &want_to_read,
@@ -118,7 +115,8 @@ int ErasureCodeClay::decode(const set<int> &want_to_read,
     avail.insert(node);
   }
 
-  if (is_repair(want_to_read, avail)) {
+  if (is_repair(want_to_read, avail) && 
+         ((unsigned int)chunk_size > chunks.begin()->second.length())) {
     return repair(want_to_read, chunks, decoded, chunk_size);
   } else {
     return ErasureCode::_decode(want_to_read, chunks, decoded);
@@ -186,15 +184,6 @@ int ErasureCodeClay::decode_chunks(const set<int> &want_to_read,
   return res;
 }
 
-unsigned int ErasureCodeClay::get_alignment() const
-{
-  unsigned alignment = k * sub_chunk_no * w * sizeof(int);
-  if ((w * sizeof(int)) % LARGEST_VECTOR_WORDSIZE) {
-    alignment = k * sub_chunk_no * w * LARGEST_VECTOR_WORDSIZE;
-  }
-  return alignment;
-}
-
 int ErasureCodeClay::parse(ErasureCodeProfile &profile,
                           ostream *ss)
 {
index 80e6f4a35a6e163245cface04ea8c9c78ffa04c8..9b23b9907c3b613a4b1adf25936d9e2a8e414a0a 100644 (file)
@@ -84,8 +84,6 @@ public:
 
   virtual int parse(ceph::ErasureCodeProfile &profile, std::ostream *ss);
 
-  unsigned get_alignment() const;
-
 private:
   int minimum_to_repair(const std::set<int> &want_to_read,
                         const std::set<int> &available_chunks,
index 0a6f181c0d02367d8a7f9b1f5fe3af67d3dbfaec..26285e6d7f23e1126687370e1e8de05e2a6fb224 100644 (file)
@@ -464,7 +464,7 @@ TEST(ErasureCodeClay, encode)
   profile["m"] = "2";
   EXPECT_EQ(0, clay.init(profile, &cerr));
 
-  unsigned aligned_object_size = clay.get_alignment() * 2;
+  unsigned aligned_object_size = clay.get_chunk_size(1) * 2 * 2;
   {
     //
     // When the input bufferlist needs to be padded because
index 410bb5ec11785bd36bc33989e3172322d3f8bfd5..3ce31b2439a582d123d2762e041bbcf148c4e388 100644 (file)
@@ -207,7 +207,7 @@ int ErasureCodeNonRegression::decode_erasures(ErasureCodeInterfaceRef erasure_co
       
   }
   map<int,bufferlist> decoded;
-  int code = erasure_code->decode(erasures, available, &decoded, 0);
+  int code = erasure_code->decode(erasures, available, &decoded, available.begin()->second.length());
   if (code)
     return code;
   for (set<int>::iterator erasure = erasures.begin();