From: Kefu Chai Date: Fri, 12 Mar 2021 11:50:45 +0000 (+0800) Subject: common/ceph_context: disable lockdep if !CEPH_DEBUG_MUTEX X-Git-Tag: v17.1.0~2626^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f42cebe9deb0a8ea22e5765f68c96a92c46231b8;p=ceph.git common/ceph_context: disable lockdep if !CEPH_DEBUG_MUTEX make lockdep a feature which can only be enabled at compile time. we don't need to have lockdep when CEPH_DEBUG_MUTEX is OFF, so just comment it out in Release builds. Signed-off-by: Kefu Chai --- diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 25e96b0966bba..47b0120d8aba8 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -31,10 +31,12 @@ #include "common/debug.h" #include "common/config.h" #include "common/ceph_crypto.h" -#include "common/lockdep.h" #include "common/HeartbeatMap.h" #include "common/errno.h" #include "common/Graylog.h" +#ifdef CEPH_DEBUG_MUTEX +#include "common/lockdep.h" +#endif #include "log/Log.h" @@ -105,6 +107,7 @@ PerfCountersCollectionImpl* CephContext::get_perfcounters_collection() #else // WITH_SEASTAR namespace { +#ifdef CEPH_DEBUG_MUTEX class LockdepObs : public md_config_obs_t { public: explicit LockdepObs(CephContext *cct) @@ -137,6 +140,7 @@ private: bool m_registered; ceph::mutex lock; }; +#endif // CEPH_DEBUG_MUTEX class MempoolObs : public md_config_obs_t, public AdminSocketHook { @@ -679,7 +683,9 @@ CephContext::CephContext(uint32_t module_type_, _crypto_none(NULL), _crypto_aes(NULL), _plugin_registry(NULL), +#ifdef CEPH_DEBUG_MUTEX _lockdep_obs(NULL), +#endif crush_location(this) { _log = new ceph::logging::Log(&_conf->subsys); @@ -689,10 +695,10 @@ CephContext::CephContext(uint32_t module_type_, _cct_obs = new CephContextObs(this); _conf.add_observer(_cct_obs); - +#ifdef CEPH_DEBUG_MUTEX _lockdep_obs = new LockdepObs(this); _conf.add_observer(_lockdep_obs); - +#endif _perf_counters_collection = new PerfCountersCollection(this); _admin_socket = new AdminSocket(this); @@ -768,11 +774,11 @@ CephContext::~CephContext() _conf.remove_observer(_cct_obs); delete _cct_obs; _cct_obs = NULL; - +#ifdef CEPH_DEBUG_MUTEX _conf.remove_observer(_lockdep_obs); delete _lockdep_obs; _lockdep_obs = NULL; - +#endif _log->stop(); delete _log; _log = NULL; diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index 27f7690078424..25f52615b067b 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -352,9 +352,9 @@ private: std::set _experimental_features; ceph::PluginRegistry* _plugin_registry; - +#ifdef CEPH_DEBUG_MUTEX md_config_obs_t *_lockdep_obs; - +#endif public: TOPNSPC::crush::CrushLocation crush_location; private: