]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: print summary for forced backfill/recovery to debug
authorSage Weil <sage@redhat.com>
Mon, 18 Sep 2017 21:53:31 +0000 (16:53 -0500)
committerDavid Zafman <dzafman@redhat.com>
Wed, 6 Mar 2019 10:20:41 +0000 (10:20 +0000)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 7816ab5a8eb0ea754a0809eb9da915a16ad39e83)

Conflicts:
src/osd/PG.h (pg_id public like master for OSDService::adjust_pg_priorities())

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

index e8b1f70b128e07510a786656fac0aba9b2c551eb..29324707b7a88a9807c6f021e17d490ff2bdfa41 100644 (file)
@@ -9599,15 +9599,29 @@ void OSDService::adjust_pg_priorities(const vector<PGRef>& pgs, int newflags)
   if (!pgs.size() || !(newflags & (OFR_BACKFILL | OFR_RECOVERY))) {
     return;
   }
+  set<spg_t> did;
   if (newflags & OFR_BACKFILL) {
     for (auto& pg : pgs) {
-      pg->set_force_backfill(!(newflags & OFR_CANCEL));
+      if (pg->set_force_backfill(!(newflags & OFR_CANCEL))) {
+       did.insert(pg->pg_id);
+      }
     }
   } else if (newflags & OFR_RECOVERY) {
     for (auto& pg : pgs) {
-      pg->set_force_recovery(!(newflags & OFR_CANCEL));
+      if (pg->set_force_recovery(!(newflags & OFR_CANCEL))) {
+       did.insert(pg->pg_id);
+      }
     }
   }
+  if (did.empty()) {
+    dout(10) << __func__ << " " << ((newflags & OFR_CANCEL) ? "cleared" : "set")
+            << " force_" << ((newflags & OFR_BACKFILL) ? "backfill" : "recovery")
+            << " on no pgs" << dendl;
+  } else {
+    dout(10) << __func__ << " " << ((newflags & OFR_CANCEL) ? "cleared" : "set")
+            << " force_" << ((newflags & OFR_BACKFILL) ? "backfill" : "recovery")
+            << " on " << did << dendl;
+  }
 }
 
 void OSD::do_recovery(
index 8cd905dfd2af3eb5808ecec41cfcb67b79997e53..3833952611cbf424aa2344432e86a7de647401da 100644 (file)
@@ -2132,8 +2132,9 @@ void PG::mark_clean()
   kick_snap_trim();
 }
 
-void PG::set_force_recovery(bool b)
+bool PG::set_force_recovery(bool b)
 {
+  bool did = false;
   lock();
   if (!deleting) {
     if (b) {
@@ -2144,18 +2145,22 @@ void PG::set_force_recovery(bool b)
        dout(20) << __func__ << " set" << dendl;
        state_set(PG_STATE_FORCED_RECOVERY);
        publish_stats_to_osd();
+       did = true;
       }
     } else if (state & PG_STATE_FORCED_RECOVERY) {
       dout(20) << __func__ << " clear" << dendl;
       state_clear(PG_STATE_FORCED_RECOVERY);
       publish_stats_to_osd();
+      did = true;
     }
   }
   unlock();
+  return did;
 }
 
-void PG::set_force_backfill(bool b)
+bool PG::set_force_backfill(bool b)
 {
+  bool did = false;
   lock();
   if (!deleting) {
     if (b) {
@@ -2166,14 +2171,17 @@ void PG::set_force_backfill(bool b)
        dout(10) << __func__ << " set" << dendl;
        state_set(PG_STATE_FORCED_RECOVERY);
        publish_stats_to_osd();
+       did = true;
       }
     } else if (state & PG_STATE_FORCED_RECOVERY) {
       dout(10) << __func__ << " clear" << dendl;
       state_clear(PG_STATE_FORCED_RECOVERY);
       publish_stats_to_osd();
+      did = true;
     }
   }
   unlock();
+  return did;
 }
 
 inline int PG::clamp_recovery_priority(int priority)
index 0afd4f49046dcefe294151a8f36d774d09379ca8..aa69de91a076393b4fca3141926cec765f4d26f8 100644 (file)
@@ -253,8 +253,8 @@ struct PGPool {
 
 class PG : public DoutPrefixProvider {
 public:
-  void set_force_recovery(bool b);
-  void set_force_backfill(bool b);
+  bool set_force_recovery(bool b);
+  bool set_force_backfill(bool b);
 
 protected:
   OSDService *osd;
@@ -2484,12 +2484,12 @@ protected:
   PG(OSDService *o, OSDMapRef curmap,
      const PGPool &pool, spg_t p);
   ~PG() override;
+  const spg_t pg_id;
 
  private:
   // Prevent copying
   explicit PG(const PG& rhs);
   PG& operator=(const PG& rhs);
-  const spg_t pg_id;
   uint64_t peer_features;
   uint64_t acting_features;
   uint64_t upacting_features;