]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: move heartbeat_check() from tick() to tick_without_osd_lock()
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 13 May 2016 12:04:33 +0000 (20:04 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 28 Jul 2016 22:22:46 +0000 (06:22 +0800)
The heartbeat_check() logic requires heartbeat_lock only, so it shall
work without osd_lock in hand. By doing this, we avoid the latency to
acquire the big osd_lock and does heartbeat_check() much accurately.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSD.cc

index 4bc3b185546647be21482fbdc49dd46238fb80c5..2a0ebe2ce9c787de18da56c14e728f1a82374160 100644 (file)
@@ -4308,10 +4308,6 @@ void OSD::tick()
 
   if (is_active() || is_waiting_for_healthy()) {
     maybe_update_heartbeat_peers();
-
-    heartbeat_lock.Lock();
-    heartbeat_check();
-    heartbeat_lock.Unlock();
   }
 
   if (is_waiting_for_healthy()) {
@@ -4345,6 +4341,10 @@ void OSD::tick_without_osd_lock()
   // osd_lock is not being held, which means the OSD state
   // might change when doing the monitor report
   if (is_active() || is_waiting_for_healthy()) {
+    heartbeat_lock.Lock();
+    heartbeat_check();
+    heartbeat_lock.Unlock();
+
     map_lock.get_read();
     Mutex::Locker l(mon_report_lock);