]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: rework tick() so we don't calculate the same thing over and again
authorJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 17 Jun 2014 16:19:34 +0000 (17:19 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 17 Jun 2014 16:21:09 +0000 (17:21 +0100)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/Monitor.cc

index 036c2f6712bb337411dad80631588a2efafd2c30..ca55a93e3513a54a6ae547010d55c979b47feefc 100644 (file)
@@ -3822,6 +3822,10 @@ void Monitor::tick()
   // trim sessions
   utime_t now = ceph_clock_now(g_ceph_context);
   xlist<MonSession*>::iterator p = session_map.sessions.begin();
+
+  bool out_for_too_long = (!exited_quorum.is_zero()
+      && now > (exited_quorum + 2*g_conf->mon_lease));
+
   while (!p.end()) {
     MonSession *s = *p;
     ++p;
@@ -3835,14 +3839,12 @@ void Monitor::tick()
               << " (until " << s->until << " < now " << now << ")" << dendl;
       messenger->mark_down(s->con);
       remove_session(s);
-    } else if (!exited_quorum.is_zero()) {
-      if (now > (exited_quorum + 2 * g_conf->mon_lease)) {
-        // boot the client Session because we've taken too long getting back in
-        dout(10) << " trimming session " << s->con << " " << s->inst
-                << " because we've been out of quorum too long" << dendl;
-        messenger->mark_down(s->con);
-        remove_session(s);
-      }
+    } else if (out_for_too_long) {
+      // boot the client Session because we've taken too long getting back in
+      dout(10) << " trimming session " << s->con << " " << s->inst
+        << " because we've been out of quorum too long" << dendl;
+      messenger->mark_down(s->con);
+      remove_session(s);
     }
   }