From a48c41684d6d1c042168e20043512ebb84761ae6 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 8 Feb 2012 12:44:42 +0100 Subject: [PATCH] treat CONFIG_MARS_DEBUG independent from CONFIG_DEBUG_KERNEL --- Kconfig | 7 +++++++ brick_checking.h | 2 +- brick_mem.c | 10 +++++----- brick_say.c | 4 ++-- brick_say.h | 6 +++--- mars_if.c | 2 +- mars_trans_logger.c | 4 ++-- sy_old/mars_light.c | 4 ++-- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Kconfig b/Kconfig index f31e6e4b..6428900c 100644 --- a/Kconfig +++ b/Kconfig @@ -8,6 +8,13 @@ config MARS ---help--- Experimental storage System. Only compile as a module! +config MARS_DEBUG + bool "enable runtime checks in MARS" + depends on MARS + default n + ---help--- + OFF for production systems. ON for testing! + config MARS_BIGMODULE tristate "compile all MARS modules into a single kernel module" depends on MARS diff --git a/brick_checking.h b/brick_checking.h index 79a1e143..5e35dae6 100644 --- a/brick_checking.h +++ b/brick_checking.h @@ -6,7 +6,7 @@ // checking -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG #define BRICK_CHECKING true #else #define BRICK_CHECKING false diff --git a/brick_mem.c b/brick_mem.c index 198a0640..17b4b6fd 100644 --- a/brick_mem.c +++ b/brick_mem.c @@ -17,7 +17,7 @@ //#define BUMP_LIMITS // try to avoid this #define ALLOW_DYNAMIC_RAISE 512 -#ifndef CONFIG_DEBUG_KERNEL +#ifndef CONFIG_MARS_DEBUG #undef BRICK_DEBUG_MEM #endif @@ -96,7 +96,7 @@ void __brick_mem_free(void *data, int len) void *_brick_mem_alloc(int len, int line) { void *res; -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG might_sleep(); #endif @@ -172,7 +172,7 @@ char *_brick_string_alloc(int len, int line) { char *res; -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG might_sleep(); #endif @@ -187,7 +187,7 @@ char *_brick_string_alloc(int len, int line) #ifdef CONFIG_MARS_MEM_RETRY for (;;) { #endif -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG res = kzalloc(len + 1024, GFP_BRICK); #else res = kzalloc(len, GFP_BRICK); @@ -448,7 +448,7 @@ void *_brick_block_alloc(loff_t pos, int len, int line) return NULL; } -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG might_sleep(); #endif diff --git a/brick_say.c b/brick_say.c index 4bc55d7b..ff07a7b4 100644 --- a/brick_say.c +++ b/brick_say.c @@ -277,7 +277,7 @@ void brick_say(int class, bool dump, const char *prefix, const char *file, int l va_end(args); _say_mark(cpu); -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG if (dump) brick_dump_stack(); #endif @@ -372,7 +372,7 @@ void exit_say(void) } EXPORT_SYMBOL_GPL(exit_say); -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG void brick_dump_stack(void) { diff --git a/brick_say.h b/brick_say.h index c3aef9f4..5c02c959 100644 --- a/brick_say.h +++ b/brick_say.h @@ -22,16 +22,16 @@ extern void brick_say(int class, bool dump, const char *prefix, const char *file extern void init_say(void); extern void exit_say(void); -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG #define INLINE static inline //#define INLINE __attribute__((__noinline__)) extern void brick_dump_stack(void); -#else // CONFIG_DEBUG_KERNEL +#else // CONFIG_MARS_DEBUG #define INLINE static inline #define brick_dump_stack() /*empty*/ -#endif // CONFIG_DEBUG_KERNEL +#endif // CONFIG_MARS_DEBUG #endif diff --git a/mars_if.c b/mars_if.c index 74fa37c7..1ade401a 100644 --- a/mars_if.c +++ b/mars_if.c @@ -145,7 +145,7 @@ void _if_unplug(struct if_input *input) LIST_HEAD(tmp_list); unsigned long flags; -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG might_sleep(); #endif diff --git a/mars_trans_logger.c b/mars_trans_logger.c index 173ba4f9..17d45467 100644 --- a/mars_trans_logger.c +++ b/mars_trans_logger.c @@ -563,7 +563,7 @@ int _write_ref_get(struct trans_logger_output *output, struct trans_logger_mref_ return -ENOMEM; } atomic64_add(mref->ref_len, &brick->shadow_mem_used); -#ifdef CONFIG_DEBUG_KERNEL +#ifdef CONFIG_MARS_DEBUG memset(data, 0x11, mref->ref_len); #endif mref_a->shadow_data = data; @@ -2116,7 +2116,7 @@ void trans_logger_log(struct trans_logger_brick *brick) */ old_wait_timeout = wait_timeout; wait_timeout = HZ / 10; // 100ms before flushing -#ifdef CONFIG_DEBUG_KERNEL // debug override for catching long blocks +#ifdef CONFIG_MARS_DEBUG // debug override for catching long blocks //wait_timeout = 16 * HZ; #endif /* Calling log_flush() too often may result in diff --git a/sy_old/mars_light.c b/sy_old/mars_light.c index cc6826d1..4550e602 100644 --- a/sy_old/mars_light.c +++ b/sy_old/mars_light.c @@ -40,7 +40,7 @@ #include "../mars_trans_logger.h" #include "../mars_if.h" #include "mars_proc.h" -#ifdef CONFIG_DEBUG_KERNEL // otherwise currently unused +#ifdef CONFIG_MARS_DEBUG // otherwise currently unused #include "../mars_dummy.h" #include "../mars_check.h" #include "../mars_buf.h" @@ -3669,7 +3669,7 @@ static int __init init_light(void) DO_INIT(brick_mem); DO_INIT(brick); DO_INIT(mars); -#ifdef CONFIG_DEBUG_KERNEL // otherwise currently unused +#ifdef CONFIG_MARS_DEBUG // otherwise currently unused DO_INIT(mars_dummy); DO_INIT(mars_check); DO_INIT(mars_buf);