aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/debug.h')
-rw-r--r--fs/ubifs/debug.h72
1 files changed, 36 insertions, 36 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index 44265a3a08ce..8c3bdd378037 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -43,11 +43,13 @@ typedef int (*dbg_znode_callback)(struct ubifs_info *c,
43 * @old_zroot: old index root - used by 'dbg_check_old_index()' 43 * @old_zroot: old index root - used by 'dbg_check_old_index()'
44 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()' 44 * @old_zroot_level: old index root level - used by 'dbg_check_old_index()'
45 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()' 45 * @old_zroot_sqnum: old index root sqnum - used by 'dbg_check_old_index()'
46 *
46 * @failure_mode: failure mode for recovery testing 47 * @failure_mode: failure mode for recovery testing
47 * @fail_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls 48 * @fail_delay: 0=>don't delay, 1=>delay a time, 2=>delay a number of calls
48 * @fail_timeout: time in jiffies when delay of failure mode expires 49 * @fail_timeout: time in jiffies when delay of failure mode expires
49 * @fail_cnt: current number of calls to failure mode I/O functions 50 * @fail_cnt: current number of calls to failure mode I/O functions
50 * @fail_cnt_max: number of calls by which to delay failure mode 51 * @fail_cnt_max: number of calls by which to delay failure mode
52 *
51 * @chk_lpt_sz: used by LPT tree size checker 53 * @chk_lpt_sz: used by LPT tree size checker
52 * @chk_lpt_sz2: used by LPT tree size checker 54 * @chk_lpt_sz2: used by LPT tree size checker
53 * @chk_lpt_wastage: used by LPT tree size checker 55 * @chk_lpt_wastage: used by LPT tree size checker
@@ -61,21 +63,36 @@ typedef int (*dbg_znode_callback)(struct ubifs_info *c,
61 * @saved_free: saved amount of free space 63 * @saved_free: saved amount of free space
62 * @saved_idx_gc_cnt: saved value of @c->idx_gc_cnt 64 * @saved_idx_gc_cnt: saved value of @c->idx_gc_cnt
63 * 65 *
66 * @chk_gen: if general extra checks are enabled
67 * @chk_index: if index xtra checks are enabled
68 * @chk_orph: if orphans extra checks are enabled
69 * @chk_lprops: if lprops extra checks are enabled
70 * @chk_fs: if UBIFS contents extra checks are enabled
71 * @tst_rcvry: if UBIFS recovery testing mode enabled
72 *
64 * @dfs_dir_name: name of debugfs directory containing this file-system's files 73 * @dfs_dir_name: name of debugfs directory containing this file-system's files
65 * @dfs_dir: direntry object of the file-system debugfs directory 74 * @dfs_dir: direntry object of the file-system debugfs directory
66 * @dfs_dump_lprops: "dump lprops" debugfs knob 75 * @dfs_dump_lprops: "dump lprops" debugfs knob
67 * @dfs_dump_budg: "dump budgeting information" debugfs knob 76 * @dfs_dump_budg: "dump budgeting information" debugfs knob
68 * @dfs_dump_tnc: "dump TNC" debugfs knob 77 * @dfs_dump_tnc: "dump TNC" debugfs knob
78 * @dfs_chk_gen: debugfs knob to enable UBIFS general extra checks
79 * @dfs_chk_index: debugfs knob to enable UBIFS index extra checks
80 * @dfs_chk_orph: debugfs knob to enable UBIFS orphans extra checks
81 * @dfs_chk_lprops: debugfs knob to enable UBIFS LEP properties extra checks
82 * @dfs_chk_fs: debugfs knob to enable UBIFS contents extra checks
83 * @dfs_tst_rcvry: debugfs knob to enable UBIFS recovery testing
69 */ 84 */
70struct ubifs_debug_info { 85struct ubifs_debug_info {
71 struct ubifs_zbranch old_zroot; 86 struct ubifs_zbranch old_zroot;
72 int old_zroot_level; 87 int old_zroot_level;
73 unsigned long long old_zroot_sqnum; 88 unsigned long long old_zroot_sqnum;
89
74 int failure_mode; 90 int failure_mode;
75 int fail_delay; 91 int fail_delay;
76 unsigned long fail_timeout; 92 unsigned long fail_timeout;
77 unsigned int fail_cnt; 93 unsigned int fail_cnt;
78 unsigned int fail_cnt_max; 94 unsigned int fail_cnt_max;
95
79 long long chk_lpt_sz; 96 long long chk_lpt_sz;
80 long long chk_lpt_sz2; 97 long long chk_lpt_sz2;
81 long long chk_lpt_wastage; 98 long long chk_lpt_wastage;
@@ -89,11 +106,24 @@ struct ubifs_debug_info {
89 long long saved_free; 106 long long saved_free;
90 int saved_idx_gc_cnt; 107 int saved_idx_gc_cnt;
91 108
109 unsigned int chk_gen:1;
110 unsigned int chk_index:1;
111 unsigned int chk_orph:1;
112 unsigned int chk_lprops:1;
113 unsigned int chk_fs:1;
114 unsigned int tst_rcvry:1;
115
92 char dfs_dir_name[UBIFS_DFS_DIR_LEN + 1]; 116 char dfs_dir_name[UBIFS_DFS_DIR_LEN + 1];
93 struct dentry *dfs_dir; 117 struct dentry *dfs_dir;
94 struct dentry *dfs_dump_lprops; 118 struct dentry *dfs_dump_lprops;
95 struct dentry *dfs_dump_budg; 119 struct dentry *dfs_dump_budg;
96 struct dentry *dfs_dump_tnc; 120 struct dentry *dfs_dump_tnc;
121 struct dentry *dfs_chk_gen;
122 struct dentry *dfs_chk_index;
123 struct dentry *dfs_chk_orph;
124 struct dentry *dfs_chk_lprops;
125 struct dentry *dfs_chk_fs;
126 struct dentry *dfs_tst_rcvry;
97}; 127};
98 128
99#define ubifs_assert(expr) do { \ 129#define ubifs_assert(expr) do { \
@@ -169,59 +199,29 @@ const char *dbg_key_str1(const struct ubifs_info *c,
169 199
170extern spinlock_t dbg_lock; 200extern spinlock_t dbg_lock;
171 201
172/*
173 * Debugging check flags.
174 *
175 * UBIFS_CHK_GEN: general checks
176 * UBIFS_CHK_INDEX: check the index
177 * UBIFS_CHK_ORPH: check orphans
178 * UBIFS_CHK_LPROPS: check lprops
179 * UBIFS_CHK_FS: check the file-system
180 */
181enum {
182 UBIFS_CHK_GEN = 0x1,
183 UBIFS_CHK_INDEX = 0x2,
184 UBIFS_CHK_ORPH = 0x8,
185 UBIFS_CHK_LPROPS = 0x20,
186 UBIFS_CHK_FS = 0x40,
187};
188
189/*
190 * Special testing flags.
191 *
192 * UBIFS_TST_RCVRY: failure mode for recovery testing
193 */
194enum {
195 UBIFS_TST_RCVRY = 0x4,
196};
197
198extern unsigned int ubifs_msg_flags;
199extern unsigned int ubifs_chk_flags;
200extern unsigned int ubifs_tst_flags;
201
202static inline int dbg_is_chk_gen(const struct ubifs_info *c) 202static inline int dbg_is_chk_gen(const struct ubifs_info *c)
203{ 203{
204 return !!(ubifs_chk_flags & UBIFS_CHK_GEN); 204 return c->dbg->chk_gen;
205} 205}
206static inline int dbg_is_chk_index(const struct ubifs_info *c) 206static inline int dbg_is_chk_index(const struct ubifs_info *c)
207{ 207{
208 return !!(ubifs_chk_flags & UBIFS_CHK_INDEX); 208 return c->dbg->chk_index;
209} 209}
210static inline int dbg_is_chk_orph(const struct ubifs_info *c) 210static inline int dbg_is_chk_orph(const struct ubifs_info *c)
211{ 211{
212 return !!(ubifs_chk_flags & UBIFS_CHK_ORPH); 212 return c->dbg->chk_orph;
213} 213}
214static inline int dbg_is_chk_lprops(const struct ubifs_info *c) 214static inline int dbg_is_chk_lprops(const struct ubifs_info *c)
215{ 215{
216 return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS); 216 return c->dbg->chk_lprops;
217} 217}
218static inline int dbg_is_chk_fs(const struct ubifs_info *c) 218static inline int dbg_is_chk_fs(const struct ubifs_info *c)
219{ 219{
220 return !!(ubifs_chk_flags & UBIFS_CHK_FS); 220 return c->dbg->chk_fs;
221} 221}
222static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) 222static inline int dbg_is_tst_rcvry(const struct ubifs_info *c)
223{ 223{
224 return !!(ubifs_tst_flags & UBIFS_TST_RCVRY); 224 return c->dbg->tst_rcvry;
225} 225}
226 226
227int ubifs_debugging_init(struct ubifs_info *c); 227int ubifs_debugging_init(struct ubifs_info *c);