Go to the documentation of this file.
22 #ifndef O2CLUSTER_MASKLOG_H
23 #define O2CLUSTER_MASKLOG_H
81 #include <linux/sched.h>
85 #define ML_TCP 0x0000000000000001ULL
86 #define ML_MSG 0x0000000000000002ULL
87 #define ML_SOCKET 0x0000000000000004ULL
88 #define ML_HEARTBEAT 0x0000000000000008ULL
89 #define ML_HB_BIO 0x0000000000000010ULL
90 #define ML_DLMFS 0x0000000000000020ULL
91 #define ML_DLM 0x0000000000000040ULL
92 #define ML_DLM_DOMAIN 0x0000000000000080ULL
93 #define ML_DLM_THREAD 0x0000000000000100ULL
94 #define ML_DLM_MASTER 0x0000000000000200ULL
95 #define ML_DLM_RECOVERY 0x0000000000000400ULL
96 #define ML_DLM_GLUE 0x0000000000000800ULL
97 #define ML_VOTE 0x0000000000001000ULL
98 #define ML_CONN 0x0000000000002000ULL
99 #define ML_QUORUM 0x0000000000004000ULL
100 #define ML_BASTS 0x0000000000008000ULL
101 #define ML_CLUSTER 0x0000000000010000ULL
104 #define ML_ERROR 0x1000000000000000ULL
105 #define ML_NOTICE 0x2000000000000000ULL
106 #define ML_KTHREAD 0x4000000000000000ULL
108 #define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE)
109 #ifndef MLOG_MASK_PREFIX
110 #define MLOG_MASK_PREFIX 0
118 #if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
119 #define ML_ALLOWED_BITS ~0
121 #define ML_ALLOWED_BITS (ML_ERROR|ML_NOTICE)
124 #define MLOG_MAX_BITS 64
132 #if BITS_PER_LONG == 32
134 #define __mlog_test_u64(mask, bits) \
135 ( (u32)(mask & 0xffffffff) & bits.words[0] || \
136 ((u64)(mask) >> 32) & bits.words[1] )
137 #define __mlog_set_u64(mask, bits) do { \
138 bits.words[0] |= (u32)(mask & 0xffffffff); \
139 bits.words[1] |= (u64)(mask) >> 32; \
141 #define __mlog_clear_u64(mask, bits) do { \
142 bits.words[0] &= ~((u32)(mask & 0xffffffff)); \
143 bits.words[1] &= ~((u64)(mask) >> 32); \
145 #define MLOG_BITS_RHS(mask) { \
147 [0] = (u32)(mask & 0xffffffff), \
148 [1] = (u64)(mask) >> 32, \
154 #define __mlog_test_u64(mask, bits) ((mask) & bits.words[0])
155 #define __mlog_set_u64(mask, bits) do { \
156 bits.words[0] |= (mask); \
158 #define __mlog_clear_u64(mask, bits) do { \
159 bits.words[0] &= ~(mask); \
161 #define MLOG_BITS_RHS(mask) { { (mask) } }
171 #define __mlog_cpu_guess ({ \
172 unsigned long _cpu = get_cpu(); \
181 #define __mlog_printk(level, fmt, args...) \
182 printk(level "(%s,%u,%lu):%s:%d " fmt, current->comm, \
183 task_pid_nr(current), __mlog_cpu_guess, \
184 __PRETTY_FUNCTION__, __LINE__ , ##args)
186 #define mlog(mask, fmt, args...) do { \
187 u64 __m = MLOG_MASK_PREFIX | (mask); \
188 if ((__m & ML_ALLOWED_BITS) && \
189 __mlog_test_u64(__m, mlog_and_bits) && \
190 !__mlog_test_u64(__m, mlog_not_bits)) { \
191 if (__m & ML_ERROR) \
192 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \
193 else if (__m & ML_NOTICE) \
194 __mlog_printk(KERN_NOTICE, fmt , ##args); \
195 else __mlog_printk(KERN_INFO, fmt , ##args); \
199 #define mlog_errno(st) do { \
201 if (_st != -ERESTARTSYS && _st != -EINTR && \
202 _st != AOP_TRUNCATED_PAGE && _st != -ENOSPC) \
203 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
206 #define mlog_bug_on_msg(cond, fmt, args...) do { \
208 mlog(ML_ERROR, "bug expression: " #cond "\n"); \
209 mlog(ML_ERROR, fmt, ##args); \