]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/: create interface for TPHandle, remove WorkQueue include from MissingLoc
authorSamuel Just <sjust@redhat.com>
Tue, 16 Apr 2019 22:37:10 +0000 (15:37 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 10 May 2019 00:22:25 +0000 (17:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/common/HBHandle.h [new file with mode: 0644]
src/common/WorkQueue.h
src/osd/MissingLoc.cc
src/osd/MissingLoc.h

diff --git a/src/common/HBHandle.h b/src/common/HBHandle.h
new file mode 100644 (file)
index 0000000..a972a93
--- /dev/null
@@ -0,0 +1,11 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+class HBHandle {
+public:
+  virtual void reset_tp_timeout() = 0;
+  virtual void suspend_tp_timeout() = 0;
+  virtual ~HBHandle() {}
+};
index d53fc0f91c6e49756fe3c7f41ecdb6ff307a8ab0..032048eedd438b3b1be22ed913974916dba8d72b 100644 (file)
@@ -36,6 +36,7 @@ struct ThreadPool {
 #include "common/HeartbeatMap.h"
 #include "common/Thread.h"
 #include "include/Context.h"
+#include "common/HBHandle.h"
 
 class CephContext;
 
@@ -53,7 +54,7 @@ class ThreadPool : public md_config_obs_t {
   ceph::condition_variable _wait_cond;
 
 public:
-  class TPHandle {
+  class TPHandle : public HBHandle {
     friend class ThreadPool;
     CephContext *cct;
     ceph::heartbeat_handle_d *hb;
@@ -66,8 +67,8 @@ public:
       time_t grace,
       time_t suicide_grace)
       : cct(cct), hb(hb), grace(grace), suicide_grace(suicide_grace) {}
-    void reset_tp_timeout();
-    void suspend_tp_timeout();
+    void reset_tp_timeout() override final;
+    void suspend_tp_timeout() override final;
   };
 private:
 
index 984beedee4dee9c78b14b346b77ed84797821127..91c1af1d13c09df300edb0b5bceca0a94d7ce5c8 100644 (file)
@@ -32,7 +32,7 @@ bool MissingLoc::readable_with_acting(
 
 void MissingLoc::add_batch_sources_info(
   const set<pg_shard_t> &sources,
-  ThreadPool::TPHandle* handle)
+  HBHandle *handle)
 {
   ldout(cct, 10) << __func__ << ": adding sources in batch "
                     << sources.size() << dendl;
@@ -68,7 +68,7 @@ bool MissingLoc::add_source_info(
   pg_shard_t fromosd,
   const pg_info_t &oinfo,
   const pg_missing_t &omissing,
-  ThreadPool::TPHandle* handle)
+  HBHandle *handle)
 {
   bool found_missing = false;
   unsigned loop = 0;
index 04f1cf86ffe4597c58d8fb6ead8b8daefea54422..19c8f872ea5d100bb47e187f37198064ef03970a 100644 (file)
@@ -7,7 +7,7 @@
 #include <set>
 
 #include "OSDMap.h"
-#include "common/WorkQueue.h"
+#include "common/HBHandle.h"
 #include "common/ceph_context.h"
 #include "common/dout.h"
 #include "osd_types.h"
@@ -258,13 +258,13 @@ class MissingLoc {
     pg_shard_t source,           ///< [in] source
     const pg_info_t &oinfo,      ///< [in] info
     const pg_missing_t &omissing, ///< [in] (optional) missing
-    ThreadPool::TPHandle* handle  ///< [in] ThreadPool handle
+    HBHandle *handle             ///< [in] ThreadPool handle
     ); ///< @return whether a new object location was discovered
 
   /// Adds recovery sources in batch
   void add_batch_sources_info(
     const set<pg_shard_t> &sources,  ///< [in] a set of resources which can be used for all objects
-    ThreadPool::TPHandle* handle  ///< [in] ThreadPool handle
+    HBHandle *handle  ///< [in] ThreadPool handle
     );
 
   /// Uses osdmap to update structures for now down sources