Skip to content

Commit

Permalink
Merge pull request #20317 from liewegas/wip-pg-scrub-priority
Browse files Browse the repository at this point in the history
osd/PG: pass scrub priority to replica

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
liewegas committed Feb 6, 2018
2 parents b2467f0 + d9fd076 commit 0ebbb1c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
18 changes: 15 additions & 3 deletions src/messages/MOSDRepScrub.h
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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),
Expand All @@ -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:
Expand All @@ -82,6 +86,8 @@ struct MOSDRepScrub : public MOSDFastDispatchOp {
<< ",deep:" << deep
<< ",version:" << header.version
<< ",allow_preemption:" << (int)allow_preemption
<< ",priority=" << priority
<< (high_priority ? " (high)":"")
<< ")";
}

Expand All @@ -99,6 +105,8 @@ struct MOSDRepScrub : public MOSDFastDispatchOp {
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();
Expand All @@ -123,6 +131,10 @@ struct MOSDRepScrub : public MOSDFastDispatchOp {
if (header.version >= 8) {
decode(allow_preemption, p);
}
if (header.version >= 9) {
decode(priority, p);
decode(high_priority, p);
}
}
};

Expand Down
11 changes: 9 additions & 2 deletions src/osd/PG.cc
Expand Up @@ -3927,7 +3927,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(
Expand Down Expand Up @@ -4393,12 +4395,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:
Expand Down

0 comments on commit 0ebbb1c

Please sign in to comment.