]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix the truncation of an int by int division 43303/head
authorRonen Friedman <rfriedma@redhat.com>
Sat, 25 Sep 2021 11:42:56 +0000 (11:42 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 25 Sep 2021 11:42:56 +0000 (11:42 +0000)
The 'r' coeff calculated in OSD::tick() was always 0.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/OSD.cc

index 425e27a3df131573a1a52b4553276b07c622045a..9e6483661c85a7f51a342aed3ec61f3c735f5c0b 100644 (file)
@@ -6099,7 +6099,7 @@ void OSD::tick()
     // use a seed that is stable for each scrub interval, but varies
     // by OSD to avoid any herds.
     rng.seed(whoami + superblock.last_purged_snaps_scrub.sec());
-    double r = (rng() % 1024) / 1024;
+    double r = (rng() % 1024) / 1024.0;
     next +=
       cct->_conf->osd_scrub_min_interval *
       cct->_conf->osd_scrub_interval_randomize_ratio * r;