From: Samuel Just Date: Tue, 5 Jan 2016 23:23:01 +0000 (-0800) Subject: OSD::ScrubJob: correctly handle small osd_scrub_interval_randomize_ratio X-Git-Tag: v10.0.2~3^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7147%2Fhead;p=ceph.git OSD::ScrubJob: correctly handle small osd_scrub_interval_randomize_ratio utime_t &operator+=(utime_t, double) exists, let's just use that and not muck about with converting the double to an int. Fixes: 14247 Signed-off-by: Samuel Just --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index f89bd828cebd..99115486b936 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6088,10 +6088,9 @@ OSDService::ScrubJob::ScrubJob(const spg_t& pg, const utime_t& timestamp, pool_scrub_max_interval : g_conf->osd_scrub_max_interval; sched_time += scrub_min_interval; - if (g_conf->osd_scrub_interval_randomize_ratio > 0) { - sched_time += rand() % (int)(scrub_min_interval * - g_conf->osd_scrub_interval_randomize_ratio); - } + double r = rand() / RAND_MAX; + sched_time += + scrub_min_interval * g_conf->osd_scrub_interval_randomize_ratio * r; deadline += scrub_max_interval; } }