]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/ceph_context: disable lockdep if !CEPH_DEBUG_MUTEX
authorKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 11:50:45 +0000 (19:50 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 17:15:07 +0000 (01:15 +0800)
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 <kchai@redhat.com>
src/common/ceph_context.cc
src/common/ceph_context.h

index 25e96b0966bbade00160bab4f8d0778c484b320c..47b0120d8aba8f6892122b74df68ea5526c646dc 100644 (file)
 #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;
index 27f76900784245a8279c1244ec5d4af109aa4d1f..25f52615b067bd8c1b1c084aac2528ee256702fa 100644 (file)
@@ -352,9 +352,9 @@ private:
   std::set<std::string> _experimental_features;
 
   ceph::PluginRegistry* _plugin_registry;
-
+#ifdef CEPH_DEBUG_MUTEX
   md_config_obs_t *_lockdep_obs;
-
+#endif
 public:
   TOPNSPC::crush::CrushLocation crush_location;
 private: