diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-06-01 17:43:43 +0300 |
---|---|---|
committer | Artem Bityutskiy <dedekind1@gmail.com> | 2011-07-04 10:54:32 +0300 |
commit | e7717060ddd509e6c305ad7bf5a090a95e91c8cf (patch) | |
tree | 03869be56858dfc5226a94129d528714838e4dc0 /fs/ubifs/debug.h | |
parent | 28488fc28aa39815b78c2cbeaaf25f33fef92ce8 (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.h | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 8c3bdd37803..43ec5d120d7 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h @@ -126,6 +126,25 @@ struct ubifs_debug_info { struct dentry *dfs_tst_rcvry; }; +/** + * ubifs_global_debug_info - global (not per-FS) UBIFS debugging information. + * + * @chk_gen: if general extra checks are enabled + * @chk_index: if index xtra checks are enabled + * @chk_orph: if orphans extra checks are enabled + * @chk_lprops: if lprops extra checks are enabled + * @chk_fs: if UBIFS contents extra checks are enabled + * @tst_rcvry: if UBIFS recovery testing mode enabled + */ +struct ubifs_global_debug_info { + unsigned int chk_gen:1; + unsigned int chk_index:1; + unsigned int chk_orph:1; + unsigned int chk_lprops:1; + unsigned int chk_fs:1; + unsigned int tst_rcvry:1; +}; + #define ubifs_assert(expr) do { \ if (unlikely(!(expr))) { \ 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, #define DBGKEY(key) dbg_key_str0(c, (key)) #define DBGKEY1(key) dbg_key_str1(c, (key)) +extern spinlock_t dbg_lock; + #define ubifs_dbg_msg(type, fmt, ...) do { \ spin_lock(&dbg_lock); \ pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \ @@ -197,31 +218,31 @@ const char *dbg_key_str1(const struct ubifs_info *c, /* Additional recovery messages */ #define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__) -extern spinlock_t dbg_lock; +extern struct ubifs_global_debug_info ubifs_dbg; static inline int dbg_is_chk_gen(const struct ubifs_info *c) { - return c->dbg->chk_gen; + return !!(ubifs_dbg.chk_gen || c->dbg->chk_gen); } static inline int dbg_is_chk_index(const struct ubifs_info *c) { - return c->dbg->chk_index; + return !!(ubifs_dbg.chk_index || c->dbg->chk_index); } static inline int dbg_is_chk_orph(const struct ubifs_info *c) { - return c->dbg->chk_orph; + return !!(ubifs_dbg.chk_orph || c->dbg->chk_orph); } static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { - return c->dbg->chk_lprops; + return !!(ubifs_dbg.chk_lprops || c->dbg->chk_lprops); } static inline int dbg_is_chk_fs(const struct ubifs_info *c) { - return c->dbg->chk_fs; + return !!(ubifs_dbg.chk_fs || c->dbg->chk_fs); } static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { - return c->dbg->tst_rcvry; + return !!(ubifs_dbg.tst_rcvry || c->dbg->tst_rcvry); } int ubifs_debugging_init(struct ubifs_info *c); |