From d9fd07696058cf79a62c327ecf08a5f8fb5b6a28 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 5 Feb 2018 07:10:54 -0600 Subject: [PATCH] osd/PG: pass scrub priority to replica If we are scrubbing with high priority on the primary, pass that along to the replica so that it can schedule its scrub work accordingly. Signed-off-by: Sage Weil --- src/messages/MOSDRepScrub.h | 18 +++++++++++++++--- src/osd/PG.cc | 11 +++++++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/messages/MOSDRepScrub.h b/src/messages/MOSDRepScrub.h index 3bd73fb28ae4..8e1933528afd 100644 --- a/src/messages/MOSDRepScrub.h +++ b/src/messages/MOSDRepScrub.h @@ -24,7 +24,7 @@ struct MOSDRepScrub : public MOSDFastDispatchOp { - static const int HEAD_VERSION = 8; + static const int HEAD_VERSION = 9; static const int COMPAT_VERSION = 6; spg_t pgid; // PG to scrub @@ -36,6 +36,8 @@ struct MOSDRepScrub : public MOSDFastDispatchOp { hobject_t end; // upper bound of scrub, exclusive bool deep; // true if scrub should be deep bool allow_preemption = false; + int32_t priority = 0; + bool high_priority = false; epoch_t get_map_epoch() const override { return map_epoch; @@ -54,7 +56,7 @@ struct MOSDRepScrub : public MOSDFastDispatchOp { MOSDRepScrub(spg_t pgid, eversion_t scrub_to, epoch_t map_epoch, epoch_t min_epoch, hobject_t start, hobject_t end, bool deep, - bool preemption) + bool preemption, int prio, bool highprio) : MOSDFastDispatchOp(MSG_OSD_REP_SCRUB, HEAD_VERSION, COMPAT_VERSION), pgid(pgid), scrub_to(scrub_to), @@ -64,7 +66,9 @@ struct MOSDRepScrub : public MOSDFastDispatchOp { start(start), end(end), deep(deep), - allow_preemption(preemption) { } + allow_preemption(preemption), + priority(prio), + high_priority(highprio) { } private: @@ -82,6 +86,8 @@ public: << ",deep:" << deep << ",version:" << header.version << ",allow_preemption:" << (int)allow_preemption + << ",priority=" << priority + << (high_priority ? " (high)":"") << ")"; } @@ -99,6 +105,8 @@ public: encode((uint32_t)-1, payload); // seed encode(min_epoch, payload); encode(allow_preemption, payload); + encode(priority, payload); + encode(high_priority, payload); } void decode_payload() override { bufferlist::iterator p = payload.begin(); @@ -123,6 +131,10 @@ public: if (header.version >= 8) { decode(allow_preemption, p); } + if (header.version >= 9) { + decode(priority, p); + decode(high_priority, p); + } } }; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 27c1fa7d21ed..188cb9898279 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3931,7 +3931,9 @@ void PG::_request_scrub_map( get_osdmap()->get_epoch(), get_last_peering_reset(), start, end, deep, - allow_preemption); + allow_preemption, + scrubber.priority, + ops_blocked_by_scrub()); // default priority, we want the rep scrub processed prior to any recovery // or client io messages (we are holding a lock!) osd->send_message_osd_cluster( @@ -4397,12 +4399,17 @@ void PG::replica_scrub( scrubber.end = msg->end; scrubber.deep = msg->deep; scrubber.epoch_start = info.history.same_interval_since; + if (msg->priority) { + scrubber.priority = msg->priority; + } else { + scrubber.priority = get_scrub_priority(); + } scrub_can_preempt = msg->allow_preemption; scrub_preempted = false; scrubber.replica_scrubmap_pos.reset(); - requeue_scrub(false); + requeue_scrub(msg->high_priority); } /* Scrub: -- 2.47.3