From 47a45441762e610eef548273c719cf70643bfeac 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 kraken, 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 673da99a8ac..905c1169482 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -916,6 +916,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) OPTION(osd_recovery_priority, OPT_U32, 5) // set default cost equal to 20MB io diff --git a/src/osd/OSD.h b/src/osd/OSD.h index d5c19ff3b45..aecb83b1dd3 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -897,7 +897,7 @@ public: PGQueueable( PGScrub(pg->get_osdmap()->get_epoch()), cct->_conf->osd_scrub_cost, - pg->get_scrub_priority(), + pg->scrubber.priority, ceph_clock_now(), entity_inst_t()))); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 068d337fe58..55288807e47 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2076,6 +2076,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 f82189cb278..e8155139674 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1101,6 +1101,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.47.3