]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: remove the lock heartbeat_update_lock, and change heatbeat_need_update to atomic... 12461/head
authorPan Liu <pan.liu@istuary.com>
Tue, 13 Dec 2016 08:27:14 +0000 (16:27 +0800)
committerPan Liu <pan.liu@istuary.com>
Tue, 13 Dec 2016 08:27:14 +0000 (16:27 +0800)
Signed-off-by: Pan Liu <pan.liu@istuary.com>
src/osd/OSD.cc
src/osd/OSD.h

index eb8f5a753ec41366700201a434819a15ec920429..e19f7e7f2bf78118ca31e54ff99822254a6d57a7 100644 (file)
@@ -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),
index 349fcaeec2f58ebe7a2767f92eb24d13edd6a177..877d9490aa2041523795f654247a8b27d8fb7a74 100644 (file)
@@ -1631,8 +1631,7 @@ private:
   map<int, int> 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<int,HeartbeatInfo> 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();