]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/ceph_mutex: note whether mutex debug methods are usable
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 3 Oct 2023 20:45:12 +0000 (20:45 +0000)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 6 Oct 2023 00:27:00 +0000 (20:27 -0400)
So we can do checks like:

    ceph_assert(!ceph::mutex_debugging || !ceph_mutex_is_locked_by_me(lock));

Without this boolean, this check:

    ceph_assert(!ceph_mutex_is_locked_by_me(lock));

will fail for all crimson/release builds because the method always returns true.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/common/ceph_mutex.h

index 6ed8c56d5dad3b8227c3faf036462ab2cab64ca6..059d81f2ac39bb1a408035c7fd616c77fc52f018 100644 (file)
@@ -83,6 +83,7 @@ namespace ceph {
     return {};
   }
 
+  static constexpr bool mutex_debugging = false;
   #define ceph_mutex_is_locked(m) true
   #define ceph_mutex_is_locked_by_me(m) true
 }
@@ -130,6 +131,8 @@ namespace ceph {
     return {std::forward<Args>(args)...};
   }
 
+  static constexpr bool mutex_debugging = true;
+
   // debug methods
   #define ceph_mutex_is_locked(m) ((m).is_locked())
   #define ceph_mutex_is_not_locked(m) (!(m).is_locked())
@@ -183,6 +186,8 @@ namespace ceph {
     return {};
   }
 
+  static constexpr bool mutex_debugging = false;
+
   // debug methods.  Note that these can blindly return true
   // because any code that does anything other than assert these
   // are true is broken.