From c2efeb4b62e6dc4e6975561eb8b20cfca66f7237 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 17 Apr 2017 14:58:02 -0700 Subject: [PATCH] osd: Give requested scrub work a higher priority Once started we now queue scrub work at higher priority than scheduled scrubs. Fixes: http://tracker.ceph.com/issues/15789 Signed-off-by: David Zafman (cherry picked from commit ebab8b1f4f67fbdec1e147c580329c1e2b5cf7cd) Conflicts: src/osd/OSD.h - in jewel, the PGScrub() call is enclosed within op_wq.queue(make_pair(...)) instead of enqueue_back() --- src/common/config_opts.h | 3 +++ src/osd/OSD.h | 2 +- src/osd/PG.cc | 2 ++ src/osd/PG.h | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 4eafaf7d42135..ce469edcb1125 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -871,6 +871,9 @@ OPTION(osd_snap_trim_cost, OPT_U32, 1<<20) // set default cost equal to 1MB io OPTION(osd_scrub_priority, OPT_U32, 5) // set default cost equal to 50MB io OPTION(osd_scrub_cost, OPT_U32, 50<<20) +// set requested scrub priority higher than scrub priority to make the +// requested scrubs jump the queue of scheduled scrubs +OPTION(osd_requested_scrub_priority, OPT_U32, 120) /** * osd_recovery_op_warn_multiple scales the normal warning threshhold, diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 84603958d6e6d..d5e0d3898e07c 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -873,7 +873,7 @@ public: PGQueueable( PGScrub(pg->get_osdmap()->get_epoch()), cct->_conf->osd_scrub_cost, - pg->get_scrub_priority(), + pg->scrubber.priority, ceph_clock_now(cct), entity_inst_t()))); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 78da795dbda1a..0684da5c6f72f 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2094,6 +2094,8 @@ bool PG::queue_scrub() if (is_scrubbing()) { return false; } + scrubber.priority = scrubber.must_scrub ? + cct->_conf->osd_requested_scrub_priority : get_scrub_priority(); scrubber.must_scrub = false; state_set(PG_STATE_SCRUBBING); if (scrubber.must_deep_scrub) { diff --git a/src/osd/PG.h b/src/osd/PG.h index 5c7f5bf0bede8..5bb7e56efde6a 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1162,6 +1162,9 @@ public: // flags to indicate explicitly requested scrubs (by admin) bool must_scrub, must_deep_scrub, must_repair; + // Priority to use for scrub scheduling + unsigned priority; + // this flag indicates whether we would like to do auto-repair of the PG or not bool auto_repair; -- 2.39.5