]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: avoid potential expensive grace calculation
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 25 Apr 2016 07:43:03 +0000 (15:43 +0800)
committerSage Weil <sage@redhat.com>
Wed, 4 May 2016 13:06:16 +0000 (09:06 -0400)
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)

src/mon/OSDMonitor.cc

index ca825bff39c2bf655c54429614ea21e25c2674da..43e529afba729374fd4937e2f2c6d38dc26c2a37 100644 (file)
@@ -1707,6 +1707,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;
+  }
+
   set<string> reporters_by_subtree;
   string reporter_subtree_level = g_conf->mon_osd_reporter_subtree_level;
   utime_t orig_grace(g_conf->osd_heartbeat_grace, 0);
@@ -1762,14 +1769,6 @@ bool OSDMonitor::check_failure(utime_t now, int target_osd, failure_info_t& fi)
           << " + " << 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)reporters_by_subtree.size() >= g_conf->mon_osd_min_down_reporters) {
     dout(1) << " we have enough reporters to mark osd." << target_osd