]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: fix i386 floating point rounding error 2173/head
authorSage Weil <sage@redhat.com>
Thu, 31 Jul 2014 00:50:39 +0000 (17:50 -0700)
committerSage Weil <sage@redhat.com>
Thu, 31 Jul 2014 00:50:39 +0000 (17:50 -0700)
This would round .123 to .122999 on i386; now it does not.

Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index e546647bd72195f643c5e31a66bf24eb015b4680..a8c2c64c6b45b1cf8f3fdde2c2bfc6e20fd70639 100644 (file)
@@ -3684,7 +3684,7 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
       ss << "value must be in the range 0..1";
       return -ERANGE;
     }
-    p.cache_target_dirty_ratio_micro = f * 1000000;
+    p.cache_target_dirty_ratio_micro = f * (double)1000000.0;
   } else if (var == "cache_target_full_ratio") {
     if (floaterr.length()) {
       ss << "error parsing float '" << val << "': " << floaterr;
@@ -3694,7 +3694,7 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
       ss << "value must be in the range 0..1";
       return -ERANGE;
     }
-    p.cache_target_full_ratio_micro = f * 1000000;
+    p.cache_target_full_ratio_micro = f * (double)1000000.0;
   } else if (var == "cache_min_flush_age") {
     if (interr.length()) {
       ss << "error parsing int '" << val << "': " << interr;