Skip to content

Commit

Permalink
OSD::ScrubJob: correctly handle small osd_scrub_interval_randomize_ratio
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
athanatos committed Jan 6, 2016
1 parent 64cb6e5 commit 5f1a530
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 5f1a530

Please sign in to comment.