From 849875edf1fe471d1f5d2677a6ebf3a8c7235fb2 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 (cherry picked from commit d9fd07696058cf79a62c327ecf08a5f8fb5b6a28) - fixed encode vs ::encode conflict --- 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 90b0746d6d64c..f4f26ee1f2d45 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)":"") << ")"; } @@ -98,6 +104,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(); @@ -122,6 +130,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 382eb2bf959dd..0641e59913e82 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3858,7 +3858,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( @@ -4394,12 +4396,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.39.5