From ebab8b1f4f67fbdec1e147c580329c1e2b5cf7cd 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 --- 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 8984c35594e32..4ff85b091a3a1 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -942,6 +942,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 73998a100e59e..8aa4e6a220268 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -961,7 +961,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(), pg->get_osdmap()->get_epoch())); diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 56b9c19bed8dd..1feb4286155fc 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2009,6 +2009,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 4763859d66b9a..e5530a11ff7c7 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1159,6 +1159,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