]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: cauchy techniques allow w 8,16,32
authorLoic Dachary <loic@dachary.org>
Tue, 27 May 2014 16:36:09 +0000 (18:36 +0200)
committerLoic Dachary <loic@dachary.org>
Mon, 4 Aug 2014 08:54:21 +0000 (10:54 +0200)
Enforce the restriction at initialization time, the same way it is done
for Reed Solomon. Choosing a w value different from 8,16,32 will lead to
memory corruption that cannot easily be traced to the cause.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/erasure-code/jerasure/ErasureCodeJerasure.cc

index ed2e583a5b2697c1851d0a59fe0e7e22e0518dea..3fa1f6cdb446c0515dec615d09fe9fa9f3a666df 100644 (file)
@@ -255,8 +255,8 @@ void ErasureCodeJerasureReedSolomonVandermonde::parse(const map<std::string,std:
   w = to_int("w", parameters, DEFAULT_W);
   if (w != 8 && w != 16 && w != 32) {
     derr << "ReedSolomonVandermonde: w=" << w
-        << " must be one of {8, 16, 32} : revert to 8 " << dendl;
-    w = 8;
+        << " must be one of {8, 16, 32} : revert to " << DEFAULT_W << dendl;
+    w = DEFAULT_W;
   }
 }
 
@@ -341,6 +341,12 @@ void ErasureCodeJerasureCauchy::parse(const map<std::string,std::string> &parame
   k = to_int("k", parameters, DEFAULT_K);
   m = to_int("m", parameters, DEFAULT_M);
   w = to_int("w", parameters, DEFAULT_W);
+  if (w != 8 && w != 16 && w != 32) {
+    derr << "Cauchy: w=" << w
+        << " must be one of {8, 16, 32} : revert to " 
+        << DEFAULT_W << dendl;
+    w = DEFAULT_W;
+  }
   packetsize = to_int("packetsize", parameters, DEFAULT_PACKETSIZE);
 }