From 1ea6fab5edc74bef7a2ef8944131194d196933cd Mon Sep 17 00:00:00 2001 From: kungf Date: Tue, 17 Oct 2017 20:32:14 +0800 Subject: [PATCH] osd: make scrub no deadline when max interval is zero some times, we only want scrub at out permitted time, avoid scrub mainly deep scrub affecting business io. this patch make no scrub deadline when osd_scrub_max_interval == 0, then we can make sure scrub can only do in expect time. Signed-off-by: kungf --- src/osd/OSD.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 87a0d5167a3..eae3340bf1d 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6808,7 +6808,12 @@ OSDService::ScrubJob::ScrubJob(CephContext* cct, double r = rand() / (double)RAND_MAX; sched_time += scrub_min_interval * cct->_conf->osd_scrub_interval_randomize_ratio * r; - deadline += scrub_max_interval; + if (scrub_max_interval == 0) { + deadline = utime_t(); + } else { + deadline += scrub_max_interval; + } + } } @@ -6911,7 +6916,7 @@ void OSD::sched_scrub() break; } - if ((scrub.deadline >= now) && !(time_permit && load_is_low)) { + if ((scrub.deadline.is_zero() || scrub.deadline >= now) && !(time_permit && load_is_low)) { dout(10) << __func__ << " not scheduling scrub for " << scrub.pgid << " due to " << (!time_permit ? "time not permit" : "high load") << dendl; continue;