From: Pan Liu Date: Tue, 13 Dec 2016 08:27:14 +0000 (+0800) Subject: osd: remove the lock heartbeat_update_lock, and change heatbeat_need_update to atomic... X-Git-Tag: v11.1.1~60^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F12461%2Fhead;p=ceph.git osd: remove the lock heartbeat_update_lock, and change heatbeat_need_update to atomic_bool Signed-off-by: Pan Liu --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index eb8f5a753ec4..e19f7e7f2bf7 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1675,7 +1675,7 @@ OSD::OSD(CephContext *cct_, ObjectStore *store_, command_tp(cct, "OSD::command_tp", "tp_osd_cmd", 1), session_waiting_lock("OSD::session_waiting_lock"), heartbeat_lock("OSD::heartbeat_lock"), - heartbeat_stop(false), heartbeat_update_lock("OSD::heartbeat_update_lock"), + heartbeat_stop(false), heartbeat_need_update(true), hbclient_messenger(hb_clientm), hb_front_server_messenger(hb_front_serverm), diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 349fcaeec2f5..877d9490aa20 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1631,8 +1631,7 @@ private: map debug_heartbeat_drops_remaining; Cond heartbeat_cond; bool heartbeat_stop; - Mutex heartbeat_update_lock; // orders under heartbeat_lock - bool heartbeat_need_update; ///< true if we need to refresh our heartbeat peers + std::atomic_bool heartbeat_need_update; map heartbeat_peers; ///< map of osd id to HeartbeatInfo utime_t last_mon_heartbeat; Messenger *hbclient_messenger; @@ -1647,16 +1646,13 @@ private: void maybe_update_heartbeat_peers(); void reset_heartbeat_peers(); bool heartbeat_peers_need_update() { - Mutex::Locker l(heartbeat_update_lock); - return heartbeat_need_update; + return heartbeat_need_update.load(); } void heartbeat_set_peers_need_update() { - Mutex::Locker l(heartbeat_update_lock); - heartbeat_need_update = true; + heartbeat_need_update.store(true); } void heartbeat_clear_peers_need_update() { - Mutex::Locker l(heartbeat_update_lock); - heartbeat_need_update = false; + heartbeat_need_update.store(false); } void heartbeat(); void heartbeat_check();