aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/cluster
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2006-05-10 21:28:59 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-06-29 17:48:30 -0400
commit2b388c67906ee8cd3bf1a600a7023cd0807d414f (patch)
tree9c03bb07a2a6e467fb9219e8c98fea1a5cec71de /fs/ocfs2/cluster
parente7515d065d09f6450c996a8fa206ad66569e183c (diff)
ocfs2: Compile-time disabling of ocfs2 debugging output.
Give gcc the chance to compile out the debug logging code in ocfs2. This saves some size at the expense of being able to debug the code. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster')
-rw-r--r--fs/ocfs2/cluster/masklog.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index 73edad782537..a42628ba9ddf 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -123,6 +123,17 @@
123#define MLOG_MASK_PREFIX 0 123#define MLOG_MASK_PREFIX 0
124#endif 124#endif
125 125
126/*
127 * When logging is disabled, force the bit test to 0 for anything other
128 * than errors and notices, allowing gcc to remove the code completely.
129 * When enabled, allow all masks.
130 */
131#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
132#define ML_ALLOWED_BITS ~0
133#else
134#define ML_ALLOWED_BITS (ML_ERROR|ML_NOTICE)
135#endif
136
126#define MLOG_MAX_BITS 64 137#define MLOG_MAX_BITS 64
127 138
128struct mlog_bits { 139struct mlog_bits {
@@ -187,7 +198,8 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
187 198
188#define mlog(mask, fmt, args...) do { \ 199#define mlog(mask, fmt, args...) do { \
189 u64 __m = MLOG_MASK_PREFIX | (mask); \ 200 u64 __m = MLOG_MASK_PREFIX | (mask); \
190 if (__mlog_test_u64(__m, mlog_and_bits) && \ 201 if ((__m & ML_ALLOWED_BITS) && \
202 __mlog_test_u64(__m, mlog_and_bits) && \
191 !__mlog_test_u64(__m, mlog_not_bits)) { \ 203 !__mlog_test_u64(__m, mlog_not_bits)) { \
192 if (__m & ML_ERROR) \ 204 if (__m & ML_ERROR) \
193 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ 205 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \
@@ -204,6 +216,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
204 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ 216 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
205} while (0) 217} while (0)
206 218
219#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
207#define mlog_entry(fmt, args...) do { \ 220#define mlog_entry(fmt, args...) do { \
208 mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ 221 mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \
209} while (0) 222} while (0)
@@ -247,6 +260,13 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
247#define mlog_exit_void() do { \ 260#define mlog_exit_void() do { \
248 mlog(ML_EXIT, "EXIT\n"); \ 261 mlog(ML_EXIT, "EXIT\n"); \
249} while (0) 262} while (0)
263#else
264#define mlog_entry(...) do { } while (0)
265#define mlog_entry_void(...) do { } while (0)
266#define mlog_exit(...) do { } while (0)
267#define mlog_exit_ptr(...) do { } while (0)
268#define mlog_exit_void(...) do { } while (0)
269#endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */
250 270
251#define mlog_bug_on_msg(cond, fmt, args...) do { \ 271#define mlog_bug_on_msg(cond, fmt, args...) do { \
252 if (cond) { \ 272 if (cond) { \