From: xie xingguo Date: Fri, 13 May 2016 12:04:33 +0000 (+0800) Subject: osd: move heartbeat_check() from tick() to tick_without_osd_lock() X-Git-Tag: ses5-milestone5~211^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9504157f084cb7581e83dc7a2212fe5c4bbf0ce3;p=ceph.git osd: move heartbeat_check() from tick() to tick_without_osd_lock() 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 4bc3b1855466..2a0ebe2ce9c7 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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);