]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
lockdep: fix shadowed global, add printout
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 1 Jun 2011 18:18:01 +0000 (11:18 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 1 Jun 2011 18:18:01 +0000 (11:18 -0700)
Fix a bug that was keeping lockdep from starting. Add a printout that
lets the user know that lockdep is enabled.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/common/Mutex.cc
src/common/common_init.cc
src/common/environment.h
src/common/lockdep.cc

index 8eb93485a96a5757d0ca23e38925af977376ab04..24ddffb1ec701a543a6b11ceafe988acb09e3789 100644 (file)
@@ -2,8 +2,6 @@
 #include "common/environment.h"
 #include "Mutex.h"
 
-int g_lockdep = get_env_int("CEPH_LOCKDEP");
-
 #ifdef LOCKDEP
 
 #include "include/types.h"
index b3c2bd999dfc775a1f1ec950aa40f4680d4f7636..c20843345e786b5c9bf0a41a4fc9986407e5a7c2 100644 (file)
@@ -195,6 +195,10 @@ void common_init(std::vector < const char* >& args,
         << TEXT_NORMAL << std::endl;
     output_ceph_version();
   }
+  if (g_lockdep) {
+    cout << TEXT_YELLOW << "*** lockdep is enabled (" << g_lockdep
+        << ") ***" << TEXT_NORMAL << std::endl;
+  }
 }
 
 static void pidfile_remove_void(void)
index c4ce7ad0153896486ffc4b0cc2069461462d8b0e..9967a0ba43aa8f95f753f30f39a8a538bf54bf2d 100644 (file)
@@ -16,5 +16,6 @@
 #define CEPH_COMMON_ENVIRONMENT_H
 
 extern bool get_env_bool(const char *key);
+extern int get_env_int(const char *key);
 
 #endif
index 0b49ab2776f65ace85f1862fe5cee94d90ee90e5..9b494420b0927f577308203a4245da6a7473e3a3 100644 (file)
@@ -1,18 +1,16 @@
-
-#include "lockdep.h"
-
-#include "include/types.h"
-#include "Clock.h"
 #include "BackTrace.h"
+#include "Clock.h"
+#include "common/config.h"
+#include "common/environment.h"
+#include "include/types.h"
+#include "lockdep.h"
 
 #include <ext/hash_map>
 
-#include "common/config.h"
-
 #define DOUT_SUBSYS lockdep
 
 // global
-int g_lockdep = 0;
+int g_lockdep = get_env_int("CEPH_LOCKDEP");
 
 // disable lockdep when this module destructs.
 struct lockdep_stopper_t {