1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _H_JFS_DEBUG
20#define _H_JFS_DEBUG
21
22
23
24
25
26
27
28
29
30
31
32
33#if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS))
34#define PROC_FS_JFS
35extern void jfs_proc_init(void);
36extern void jfs_proc_clean(void);
37#endif
38
39
40
41
42#define assert(p) do { \
43 if (!(p)) { \
44 printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
45 __FILE__, __LINE__, #p); \
46 BUG(); \
47 } \
48} while (0)
49
50
51
52
53
54#ifdef CONFIG_JFS_DEBUG
55#define ASSERT(p) assert(p)
56
57
58#define JFS_LOGLEVEL_ERR 1
59#define JFS_LOGLEVEL_WARN 2
60#define JFS_LOGLEVEL_DEBUG 3
61#define JFS_LOGLEVEL_INFO 4
62
63extern int jfsloglevel;
64
65extern const struct file_operations jfs_txanchor_proc_fops;
66
67
68#define jfs_info(fmt, arg...) do { \
69 if (jfsloglevel >= JFS_LOGLEVEL_INFO) \
70 printk(KERN_INFO fmt "\n", ## arg); \
71} while (0)
72
73
74#define jfs_debug(fmt, arg...) do { \
75 if (jfsloglevel >= JFS_LOGLEVEL_DEBUG) \
76 printk(KERN_DEBUG fmt "\n", ## arg); \
77} while (0)
78
79
80#define jfs_warn(fmt, arg...) do { \
81 if (jfsloglevel >= JFS_LOGLEVEL_WARN) \
82 printk(KERN_WARNING fmt "\n", ## arg); \
83} while (0)
84
85
86#define jfs_err(fmt, arg...) do { \
87 if (jfsloglevel >= JFS_LOGLEVEL_ERR) \
88 printk(KERN_ERR fmt "\n", ## arg); \
89} while (0)
90
91
92
93
94
95#else
96#define ASSERT(p) do {} while (0)
97#define jfs_info(fmt, arg...) do {} while (0)
98#define jfs_debug(fmt, arg...) do {} while (0)
99#define jfs_warn(fmt, arg...) do {} while (0)
100#define jfs_err(fmt, arg...) do {} while (0)
101#endif
102
103
104
105
106
107#ifdef CONFIG_JFS_STATISTICS
108extern const struct file_operations jfs_lmstats_proc_fops;
109extern const struct file_operations jfs_txstats_proc_fops;
110extern const struct file_operations jfs_mpstat_proc_fops;
111extern const struct file_operations jfs_xtstat_proc_fops;
112
113#define INCREMENT(x) ((x)++)
114#define DECREMENT(x) ((x)--)
115#define HIGHWATERMARK(x,y) ((x) = max((x), (y)))
116#else
117#define INCREMENT(x)
118#define DECREMENT(x)
119#define HIGHWATERMARK(x,y)
120#endif
121
122#endif
123