]> 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)
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 207311bae081bf76b45aba3114754f55774f4123..c9cbe9ed355d2e8c7ad39da48900fe6d4bf955e6 100644 (file)
@@ -8738,15 +8738,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 00f29614986e43d2b18ae69e0a37d2e437760f7f..47817f0bb919ab739d67eb63fe912add4eacf610 100644 (file)
@@ -2001,8 +2001,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) {
@@ -2013,18 +2014,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) {
@@ -2035,14 +2040,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 03e4d511995a84ca6323e6a782dc669e631444ea..2e75fff4f8471eb29dbca4e5673855268e3d4f6e 100644 (file)
@@ -429,8 +429,8 @@ public:
   bool is_forced_recovery_or_backfill() const {
     return get_state() & (PG_STATE_FORCED_RECOVERY | PG_STATE_FORCED_BACKFILL);
   }
-  void set_force_recovery(bool b);
-  void set_force_backfill(bool b);
+  bool set_force_recovery(bool b);
+  bool set_force_backfill(bool b);
 
   void queue_peering_event(CephPeeringEvtRef evt);
   void process_peering_event(RecoveryCtx *rctx);