]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: pass scrub priority to replica
authorSage Weil <sage@redhat.com>
Mon, 5 Feb 2018 13:10:54 +0000 (07:10 -0600)
committerDavid Zafman <dzafman@redhat.com>
Fri, 18 May 2018 16:37:56 +0000 (09:37 -0700)
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 <sage@redhat.com>
(cherry picked from commit d9fd07696058cf79a62c327ecf08a5f8fb5b6a28)

- fixed encode vs ::encode conflict

src/messages/MOSDRepScrub.h
src/osd/PG.cc

index 90b0746d6d64c75afd64f4be700a638fc17a6f13..f4f26ee1f2d45860ebd97a9d5211e145add12f90 100644 (file)
@@ -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);
+    }
   }
 };
 
index 382eb2bf959dd11fce583ca806335a6e3728ae97..0641e59913e829c19c6ef0c34ad3e445da48d177 100644 (file)
@@ -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: