From: kungf Date: Tue, 17 Oct 2017 12:32:14 +0000 (+0800) Subject: osd: make scrub no deadline when max interval is zero X-Git-Tag: v13.0.1~485^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1ea6fab5edc74bef7a2ef8944131194d196933cd;p=ceph.git 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 87a0d5167a36..eae3340bf1d1 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;