]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: avoid potential expensive grace calculation 9416/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 31 May 2016 22:40:05 +0000 (15:40 -0700)
committerJesse Williamson <jwilliamson@suse.de>
Thu, 28 Jul 2016 21:43:54 +0000 (14:43 -0700)
The grace calculation during check_failure() is now very complicated
and time-consuming. Therefore we shall skip this when it is possible.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
(cherry picked from commit 3557903d5d57642179b2ae137bedc389974b1956)

 Conflicts:
src/mon/OSDMonitor.cc

Resolved by choosing the move-to-top implementation. Removed unused vars.

src/mon/OSDMonitor.cc

index c647c60017d6d70de8703651b8f124e401ab30aa..5c7ef72e7a3c522bbe654aa6fbff5531c9ee5391 100644 (file)
@@ -1494,6 +1494,13 @@ void OSDMonitor::check_failures(utime_t now)
 
 bool OSDMonitor::check_failure(utime_t now, int target_osd, failure_info_t& fi)
 {
+  // already pending failure?
+  if (pending_inc.new_state.count(target_osd) &&
+      pending_inc.new_state[target_osd] & CEPH_OSD_UP) {
+    dout(10) << " already pending failure" << dendl;
+    return true;
+  }
+
   utime_t orig_grace(g_conf->osd_heartbeat_grace, 0);
   utime_t max_failed_since = fi.get_failed_since();
   utime_t failed_for = now - max_failed_since;
@@ -1537,13 +1544,6 @@ bool OSDMonitor::check_failure(utime_t now, int target_osd, failure_info_t& fi)
           << grace << " grace (" << orig_grace << " + " << my_grace << " + " << peer_grace << "), max_failed_since " << max_failed_since
           << dendl;
 
-  // already pending failure?
-  if (pending_inc.new_state.count(target_osd) &&
-      pending_inc.new_state[target_osd] & CEPH_OSD_UP) {
-    dout(10) << " already pending failure" << dendl;
-    return true;
-  }
-
   if (failed_for >= grace &&
       ((int)fi.reporters.size() >= g_conf->mon_osd_min_down_reporters) &&
       (fi.num_reports >= g_conf->mon_osd_min_down_reports)) {