]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/lockdep: disable lockdep if !CEPH_DEBUG_MUTEX
authorKefu Chai <kchai@redhat.com>
Fri, 12 Mar 2021 13:12:08 +0000 (21:12 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 13 Mar 2021 03:34:34 +0000 (11:34 +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/lockdep.h

index 240347d02e3b2996322294ab234b7088b7c6cbb5..f2376d0b12226cd5821d4f0e10ae2fa2e2e730e6 100644 (file)
@@ -16,6 +16,9 @@
 #define CEPH_LOCKDEP_H
 
 #include "include/common_fwd.h"
+
+#ifdef CEPH_DEBUG_MUTEX
+
 extern bool g_lockdep;
 
 extern void lockdep_register_ceph_context(CephContext *cct);
@@ -30,4 +33,17 @@ extern int lockdep_will_lock(const char *n, int id, bool force_backtrace=false,
 extern int lockdep_locked(const char *n, int id, bool force_backtrace=false);
 extern int lockdep_will_unlock(const char *n, int id);
 extern int lockdep_dump_locks();
+
+#else
+
+static constexpr bool g_lockdep = false;
+#define lockdep_register(...) 0
+#define lockdep_unregister(...)
+#define lockdep_will_lock(...) 0
+#define lockdep_locked(...) 0
+#define lockdep_will_unlock(...) 0
+
+#endif // CEPH_DEBUG_MUTEX
+
+
 #endif