]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/common/HeartbeatMap.cc
update sources to v12.1.0
[ceph.git] / ceph / src / common / HeartbeatMap.cc
index 9167ba67984664cf6ce70bb738b19b3bd93329eb..ae1f8e8faae78a66eda32f5cb083ddd730ff1d85 100644 (file)
  * 
  */
 
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include "HeartbeatMap.h"
 #include "ceph_context.h"
 #include "common/errno.h"
-#include "common/valgrind.h"
-
 #include "debug.h"
+
 #define dout_subsys ceph_subsys_heartbeatmap
 #undef dout_prefix
 #define dout_prefix *_dout << "heartbeat_map "
@@ -76,13 +69,13 @@ bool HeartbeatMap::_check(const heartbeat_handle_d *h, const char *who, time_t n
   bool healthy = true;
   time_t was;
 
-  was = h->timeout.read();
+  was = h->timeout;
   if (was && was < now) {
     ldout(m_cct, 1) << who << " '" << h->name << "'"
                    << " had timed out after " << h->grace << dendl;
     healthy = false;
   }
-  was = h->suicide_timeout.read();
+  was = h->suicide_timeout;
   if (was && was < now) {
     ldout(m_cct, 1) << who << " '" << h->name << "'"
                    << " had suicide timed out after " << h->suicide_grace << dendl;
@@ -100,13 +93,13 @@ void HeartbeatMap::reset_timeout(heartbeat_handle_d *h, time_t grace, time_t sui
   time_t now = time(NULL);
   _check(h, "reset_timeout", now);
 
-  h->timeout.set(now + grace);
+  h->timeout = now + grace;
   h->grace = grace;
 
   if (suicide_grace)
-    h->suicide_timeout.set(now + suicide_grace);
+    h->suicide_timeout = now + suicide_grace;
   else
-    h->suicide_timeout.set(0);
+    h->suicide_timeout = 0;
   h->suicide_grace = suicide_grace;
 }
 
@@ -115,8 +108,8 @@ void HeartbeatMap::clear_timeout(heartbeat_handle_d *h)
   ldout(m_cct, 20) << "clear_timeout '" << h->name << "'" << dendl;
   time_t now = time(NULL);
   _check(h, "clear_timeout", now);
-  h->timeout.set(0);
-  h->suicide_timeout.set(0);
+  h->timeout = 0;
+  h->suicide_timeout = 0;
 }
 
 bool HeartbeatMap::is_healthy()
@@ -149,8 +142,8 @@ bool HeartbeatMap::is_healthy()
   }
   m_rwlock.put_read();
 
-  m_unhealthy_workers.set(unhealthy);
-  m_total_workers.set(total);
+  m_unhealthy_workers = unhealthy;
+  m_total_workers = total;
 
   ldout(m_cct, 20) << "is_healthy = " << (healthy ? "healthy" : "NOT HEALTHY")
     << ", total workers: " << total << ", number of unhealthy: " << unhealthy << dendl;
@@ -159,12 +152,12 @@ bool HeartbeatMap::is_healthy()
 
 int HeartbeatMap::get_unhealthy_workers() const
 {
-  return m_unhealthy_workers.read();
+  return m_unhealthy_workers;
 }
 
 int HeartbeatMap::get_total_workers() const
 {
-  return m_total_workers.read();
+  return m_total_workers;
 }
 
 void HeartbeatMap::check_touch_file()