]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: simplify unfound recovery case; rename method
authorSage Weil <sage@redhat.com>
Sun, 17 Sep 2017 23:29:38 +0000 (18:29 -0500)
committerSage Weil <sage@redhat.com>
Fri, 6 Oct 2017 18:08:18 +0000 (13:08 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h

index 4c21f392d573f3ddb4a3b4bd8600d32a2289fdfb..8d8c17c88482c23e5449a93d0c45374c75fa35c4 100644 (file)
@@ -8850,15 +8850,12 @@ void OSD::do_recovery(
     dout(10) << "do_recovery started " << started << "/" << reserved_pushes 
             << " on " << *pg << dendl;
 
-    // If no recovery op is started, don't bother to manipulate the RecoveryCtx
-    if (!started && (wip || !pg->have_unfound())) {
-      goto out;
+    if (!wip && pg->have_unfound()) {
+      PG::RecoveryCtx rctx = create_context();
+      rctx.handle = &handle;
+      pg->find_unfound(queued, &rctx);
+      dispatch_context(rctx, pg, pg->get_osdmap());
     }
-
-    PG::RecoveryCtx rctx = create_context();
-    rctx.handle = &handle;
-    pg->stuck_on_unfound(queued, wip, &rctx);
-    dispatch_context(rctx, pg, pg->get_osdmap());
   }
 
  out:
index fa5104494ad1868935fc6191b13697156407fcbc..955d213c68166cb509f1963bec391e8333fdb933 100644 (file)
@@ -5734,7 +5734,7 @@ void PG::queue_query(epoch_t msg_epoch,
                                         MQuery(from, q, query_epoch))));
 }
 
-void PG::stuck_on_unfound(epoch_t queued, bool wip, RecoveryCtx *rctx)
+void PG::find_unfound(epoch_t queued, RecoveryCtx *rctx)
 {
   /*
     * if we couldn't start any recovery ops and things are still
@@ -5742,34 +5742,32 @@ void PG::stuck_on_unfound(epoch_t queued, bool wip, RecoveryCtx *rctx)
     * It may be that our initial locations were bad and we errored
     * out while trying to pull.
     */
-  if (!wip && have_unfound()) {
-    discover_all_missing(*rctx->query_map);
-    if (rctx->query_map->empty()) {
-      string action;
-      if (state_test(PG_STATE_BACKFILLING)) {
-       auto evt = PG::CephPeeringEvtRef(
-         new PG::CephPeeringEvt(
-           queued,
-           queued,
-           PG::DeferBackfill(cct->_conf->osd_recovery_retry_interval)));
-       queue_peering_event(evt);
-       action = "in backfill";
-      } else if (state_test(PG_STATE_RECOVERING)) {
-       auto evt = PG::CephPeeringEvtRef(
-         new PG::CephPeeringEvt(
-           queued,
-           queued,
-           PG::DeferRecovery(cct->_conf->osd_recovery_retry_interval)));
-       queue_peering_event(evt);
-       action = "in recovery";
-      } else {
-       action = "already out of recovery/backfill";
-      }
-      dout(10) << __func__ << ": no luck, giving up on this pg for now (" << action << ")" << dendl;
+  discover_all_missing(*rctx->query_map);
+  if (rctx->query_map->empty()) {
+    string action;
+    if (state_test(PG_STATE_BACKFILLING)) {
+      auto evt = PG::CephPeeringEvtRef(
+       new PG::CephPeeringEvt(
+         queued,
+         queued,
+         PG::DeferBackfill(cct->_conf->osd_recovery_retry_interval)));
+      queue_peering_event(evt);
+      action = "in backfill";
+    } else if (state_test(PG_STATE_RECOVERING)) {
+      auto evt = PG::CephPeeringEvtRef(
+       new PG::CephPeeringEvt(
+         queued,
+         queued,
+         PG::DeferRecovery(cct->_conf->osd_recovery_retry_interval)));
+      queue_peering_event(evt);
+      action = "in recovery";
     } else {
-      dout(10) << __func__ << ": no luck, giving up on this pg for now (queue_recovery)" << dendl;
-      queue_recovery();
+      action = "already out of recovery/backfill";
     }
+    dout(10) << __func__ << ": no luck, giving up on this pg for now (" << action << ")" << dendl;
+  } else {
+    dout(10) << __func__ << ": no luck, giving up on this pg for now (queue_recovery)" << dendl;
+    queue_recovery();
   }
 }
 
index b7bb23ccdefd80b7c2ae1c2692527797868f2538..c9c362ab45bea53c85302674e3631352a9988493 100644 (file)
@@ -436,7 +436,7 @@ public:
     uint64_t *ops_begun) = 0;
 
   // more work after the above, but with a RecoveryCtx
-  void stuck_on_unfound(epoch_t queued, bool wip, RecoveryCtx *rctx);
+  void find_unfound(epoch_t queued, RecoveryCtx *rctx);
 
   virtual void get_watchers(std::list<obj_watch_item_t> *ls) = 0;