]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code: shec must compare for equality with epsilon 6068/head
authorLoic Dachary <ldachary@redhat.com>
Thu, 24 Sep 2015 09:35:13 +0000 (11:35 +0200)
committerLoic Dachary <ldachary@redhat.com>
Fri, 25 Sep 2015 15:04:10 +0000 (17:04 +0200)
When comparing two double for strict inequality, a test for equality
using epsilon must also be done to ensure the results do not vary cross
platform.

http://tracker.ceph.com/issues/12936 Fixes: #12936

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/erasure-code/shec/ErasureCodeShec.cc
src/erasure-code/shec/ErasureCodeShec.h

index 5dcaf44da125940d39214f6f997d8d5ae44fcdf6..21803286a23d2f0add46bb82dae122710cc64495 100644 (file)
@@ -501,7 +501,8 @@ int* ErasureCodeShec::shec_reedsolomon_coding_matrix(int is_single)
         if (true) {
           double r_e1;
           r_e1 = shec_calc_recovery_efficiency1(k, m1, m2, c1, c2);
-          if (r_e1 < min_r_e1){
+          if (min_r_e1 - r_e1 > std::numeric_limits<double>::epsilon() &&
+             r_e1 < min_r_e1) {
             min_r_e1 = r_e1;
             c1_best = c1;
             m1_best = m1;
index 9eeb3d42e548a4fb0e1b4caf1d3b796379c92cd3..bf07b804193735507201d4527d6417b35032ad54 100644 (file)
@@ -124,12 +124,7 @@ public:
 private:
   virtual int parse(const ErasureCodeProfile &profile) = 0;
 
-  virtual double shec_calc_recovery_efficiency1(int k, int m1, int m2, int c1, int c2)
-  // http://tracker.ceph.com/issues/12936 shec fails i386 make check
-#if defined(__i386__) && defined(__GNUC__)
-    __attribute__((optimize(0)))
-#endif    
-    ;
+  virtual double shec_calc_recovery_efficiency1(int k, int m1, int m2, int c1, int c2);
   virtual int shec_make_decoding_matrix(bool prepare,
                                         int *want, int *avails,
                                         int *decoding_matrix,