From: Samuel Just Date: Tue, 16 Apr 2019 22:37:10 +0000 (-0700) Subject: osd/: create interface for TPHandle, remove WorkQueue include from MissingLoc X-Git-Tag: v15.1.0~2702^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5eda7afb365d2477b1250a1b36e7b8660737c7d5;p=ceph.git osd/: create interface for TPHandle, remove WorkQueue include from MissingLoc Signed-off-by: Samuel Just --- diff --git a/src/common/HBHandle.h b/src/common/HBHandle.h new file mode 100644 index 000000000000..a972a93c66c7 --- /dev/null +++ b/src/common/HBHandle.h @@ -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() {} +}; diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index d53fc0f91c6e..032048eedd43 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -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: diff --git a/src/osd/MissingLoc.cc b/src/osd/MissingLoc.cc index 984beedee4de..91c1af1d13c0 100644 --- a/src/osd/MissingLoc.cc +++ b/src/osd/MissingLoc.cc @@ -32,7 +32,7 @@ bool MissingLoc::readable_with_acting( void MissingLoc::add_batch_sources_info( const set &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; diff --git a/src/osd/MissingLoc.h b/src/osd/MissingLoc.h index 04f1cf86ffe4..19c8f872ea5d 100644 --- a/src/osd/MissingLoc.h +++ b/src/osd/MissingLoc.h @@ -7,7 +7,7 @@ #include #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 &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