aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/debug.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-06-01 10:43:43 -0400
committerArtem Bityutskiy <dedekind1@gmail.com>2011-07-04 03:54:32 -0400
commite7717060ddd509e6c305ad7bf5a090a95e91c8cf (patch)
tree03869be56858dfc5226a94129d528714838e4dc0 /fs/ubifs/debug.h
parent28488fc28aa39815b78c2cbeaaf25f33fef92ce8 (diff)
UBIFS: add global debugfs knobs
Now we have per-FS (superblock) debugfs knobs, but they have one drawback - you have to first mount the FS and only after this you can switch self-checks on/off. But often we want to have the checks enabled during the mount. Introduce global debugging knobs for this purpose. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/debug.h')
-rw-r--r--fs/ubifs/debug.h35
1 files changed, 28 insertions, 7 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index 8c3bdd378037..43ec5d120d7c 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -126,6 +126,25 @@ struct ubifs_debug_info {
126 struct dentry *dfs_tst_rcvry; 126 struct dentry *dfs_tst_rcvry;
127}; 127};
128 128
129/**
130 * ubifs_global_debug_info - global (not per-FS) UBIFS debugging information.
131 *
132 * @chk_gen: if general extra checks are enabled
133 * @chk_index: if index xtra checks are enabled
134 * @chk_orph: if orphans extra checks are enabled
135 * @chk_lprops: if lprops extra checks are enabled
136 * @chk_fs: if UBIFS contents extra checks are enabled
137 * @tst_rcvry: if UBIFS recovery testing mode enabled
138 */
139struct ubifs_global_debug_info {
140 unsigned int chk_gen:1;
141 unsigned int chk_index:1;
142 unsigned int chk_orph:1;
143 unsigned int chk_lprops:1;
144 unsigned int chk_fs:1;
145 unsigned int tst_rcvry:1;
146};
147
129#define ubifs_assert(expr) do { \ 148#define ubifs_assert(expr) do { \
130 if (unlikely(!(expr))) { \ 149 if (unlikely(!(expr))) { \
131 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ 150 printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
@@ -162,6 +181,8 @@ const char *dbg_key_str1(const struct ubifs_info *c,
162#define DBGKEY(key) dbg_key_str0(c, (key)) 181#define DBGKEY(key) dbg_key_str0(c, (key))
163#define DBGKEY1(key) dbg_key_str1(c, (key)) 182#define DBGKEY1(key) dbg_key_str1(c, (key))
164 183
184extern spinlock_t dbg_lock;
185
165#define ubifs_dbg_msg(type, fmt, ...) do { \ 186#define ubifs_dbg_msg(type, fmt, ...) do { \
166 spin_lock(&dbg_lock); \ 187 spin_lock(&dbg_lock); \
167 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \ 188 pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \
@@ -197,31 +218,31 @@ const char *dbg_key_str1(const struct ubifs_info *c,
197/* Additional recovery messages */ 218/* Additional recovery messages */
198#define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__) 219#define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__)
199 220
200extern spinlock_t dbg_lock; 221extern struct ubifs_global_debug_info ubifs_dbg;
201 222
202static inline int dbg_is_chk_gen(const struct ubifs_info *c) 223static inline int dbg_is_chk_gen(const struct ubifs_info *c)
203{ 224{
204 return c->dbg->chk_gen; 225 return !!(ubifs_dbg.chk_gen || c->dbg->chk_gen);
205} 226}
206static inline int dbg_is_chk_index(const struct ubifs_info *c) 227static inline int dbg_is_chk_index(const struct ubifs_info *c)
207{ 228{
208 return c->dbg->chk_index; 229 return !!(ubifs_dbg.chk_index || c->dbg->chk_index);
209} 230}
210static inline int dbg_is_chk_orph(const struct ubifs_info *c) 231static inline int dbg_is_chk_orph(const struct ubifs_info *c)
211{ 232{
212 return c->dbg->chk_orph; 233 return !!(ubifs_dbg.chk_orph || c->dbg->chk_orph);
213} 234}
214static inline int dbg_is_chk_lprops(const struct ubifs_info *c) 235static inline int dbg_is_chk_lprops(const struct ubifs_info *c)
215{ 236{
216 return c->dbg->chk_lprops; 237 return !!(ubifs_dbg.chk_lprops || c->dbg->chk_lprops);
217} 238}
218static inline int dbg_is_chk_fs(const struct ubifs_info *c) 239static inline int dbg_is_chk_fs(const struct ubifs_info *c)
219{ 240{
220 return c->dbg->chk_fs; 241 return !!(ubifs_dbg.chk_fs || c->dbg->chk_fs);
221} 242}
222static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) 243static inline int dbg_is_tst_rcvry(const struct ubifs_info *c)
223{ 244{
224 return c->dbg->tst_rcvry; 245 return !!(ubifs_dbg.tst_rcvry || c->dbg->tst_rcvry);
225} 246}
226 247
227int ubifs_debugging_init(struct ubifs_info *c); 248int ubifs_debugging_init(struct ubifs_info *c);