]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: drop waiting_on, use waiting_on_whom
authorSage Weil <sage@redhat.com>
Thu, 16 Nov 2017 14:57:13 +0000 (08:57 -0600)
committerDavid Zafman <dzafman@redhat.com>
Fri, 18 May 2018 16:37:55 +0000 (09:37 -0700)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 004ee202fac7a2f3fba2b018426474eeae7f913b)

Add changes to PG::sub_op_scrub_map() which exists in Luminous

src/osd/PG.cc
src/osd/PG.h

index ec3178103026d86957b62b565f400b4fd1a97e4a..6534979a1eefb8c6b02560038fec2e75db82b56b 100644 (file)
@@ -1011,7 +1011,7 @@ PG::Scrubber::Scrubber()
  : reserved(false), reserve_failed(false),
    epoch_start(0),
    active(false),
-   waiting_on(0), shallow_errors(0), deep_errors(0), fixed(0),
+   shallow_errors(0), deep_errors(0), fixed(0),
    must_scrub(false), must_deep_scrub(false), must_repair(false),
    auto_repair(false),
    num_digest_updates_pending(0),
@@ -3788,9 +3788,11 @@ void PG::do_replica_scrub_map(OpRequestRef op)
           << scrubber.received_maps[m->from].valid_through
           << dendl;
 
-  --scrubber.waiting_on;
+  dout(10) << __func__ << " waiting_on_whom was " << scrubber.waiting_on_whom
+          << dendl;
+  assert(scrubber.waiting_on_whom.count(m->from));
   scrubber.waiting_on_whom.erase(m->from);
-  if (scrubber.waiting_on == 0) {
+  if (scrubber.waiting_on_whom.empty()) {
     if (ops_blocked_by_scrub()) {
       requeue_scrub(true);
     } else {
@@ -3827,10 +3829,9 @@ void PG::sub_op_scrub_map(OpRequestRef op)
             << scrubber.received_maps[m->from].valid_through
             << dendl;
 
-  --scrubber.waiting_on;
   scrubber.waiting_on_whom.erase(m->from);
 
-  if (scrubber.waiting_on == 0) {
+  if (scrubber.waiting_on_whom.empty()) {
     if (ops_blocked_by_scrub()) {
       requeue_scrub(true);
     } else {
@@ -4711,7 +4712,6 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
         // ask replicas to wait until
         // last_update_applied >= scrubber.subset_last_update and then scan
         scrubber.waiting_on_whom.insert(pg_whoami);
-        ++scrubber.waiting_on;
 
         // request maps from replicas
        for (set<pg_shard_t>::iterator i = actingbackfill.begin();
@@ -4722,8 +4722,9 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
                              scrubber.start, scrubber.end, scrubber.deep,
                             scrubber.seed);
           scrubber.waiting_on_whom.insert(*i);
-          ++scrubber.waiting_on;
         }
+       dout(10) << __func__ << " waiting_on_whom " << scrubber.waiting_on_whom
+                << dendl;
 
         scrubber.state = PG::Scrubber::WAIT_PUSHES;
 
@@ -4763,14 +4764,16 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
           return;
         }
 
-        --scrubber.waiting_on;
+       dout(10) << __func__ << " waiting_on_whom was "
+                << scrubber.waiting_on_whom << dendl;
+       assert(scrubber.waiting_on_whom.count(pg_whoami));
         scrubber.waiting_on_whom.erase(pg_whoami);
 
         scrubber.state = PG::Scrubber::WAIT_REPLICAS;
         break;
 
       case PG::Scrubber::WAIT_REPLICAS:
-        if (scrubber.waiting_on > 0) {
+        if (!scrubber.waiting_on_whom.empty()) {
           // will be requeued by sub_op_scrub_map
           dout(10) << "wait for replicas to build scrub map" << dendl;
           done = true;
@@ -4781,7 +4784,7 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
 
       case PG::Scrubber::COMPARE_MAPS:
         assert(last_update_applied >= scrubber.subset_last_update);
-        assert(scrubber.waiting_on == 0);
+        assert(scrubber.waiting_on_whom.empty());
 
         scrub_compare_maps();
        scrubber.start = scrubber.end;
@@ -7512,7 +7515,6 @@ boost::statechart::result PG::RecoveryState::Active::react(const QueryState& q)
     q.f->dump_stream("scrubber.subset_last_update") << pg->scrubber.subset_last_update;
     q.f->dump_bool("scrubber.deep", pg->scrubber.deep);
     q.f->dump_unsigned("scrubber.seed", pg->scrubber.seed);
-    q.f->dump_int("scrubber.waiting_on", pg->scrubber.waiting_on);
     {
       q.f->open_array_section("scrubber.waiting_on_whom");
       for (set<pg_shard_t>::iterator p = pg->scrubber.waiting_on_whom.begin();
index a6a73466a8af48f40c3b6dd3e4a7ce8e38ef0516..b584fe4c3b0196f46ea4d89956a35234f46b64a1 100644 (file)
@@ -1211,7 +1211,6 @@ public:
 
     // common to both scrubs
     bool active;
-    int waiting_on;
     set<pg_shard_t> waiting_on_whom;
     int shallow_errors;
     int deep_errors;
@@ -1313,7 +1312,6 @@ public:
     // clear all state
     void reset() {
       active = false;
-      waiting_on = 0;
       waiting_on_whom.clear();
       if (active_rep_scrub) {
         active_rep_scrub = OpRequestRef();