diff options
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/commit.c | 2 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 30 | ||||
-rw-r--r-- | fs/ubifs/debug.h | 66 | ||||
-rw-r--r-- | fs/ubifs/dir.c | 2 | ||||
-rw-r--r-- | fs/ubifs/log.c | 2 | ||||
-rw-r--r-- | fs/ubifs/lprops.c | 6 | ||||
-rw-r--r-- | fs/ubifs/lpt.c | 2 | ||||
-rw-r--r-- | fs/ubifs/lpt_commit.c | 10 | ||||
-rw-r--r-- | fs/ubifs/orphan.c | 2 | ||||
-rw-r--r-- | fs/ubifs/scan.c | 2 | ||||
-rw-r--r-- | fs/ubifs/tnc.c | 2 | ||||
-rw-r--r-- | fs/ubifs/tnc_commit.c | 5 |
12 files changed, 75 insertions, 56 deletions
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c index 637e07673c3a..63c4e447f977 100644 --- a/fs/ubifs/commit.c +++ b/fs/ubifs/commit.c | |||
@@ -576,7 +576,7 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot) | |||
576 | struct idx_node *i; | 576 | struct idx_node *i; |
577 | size_t sz; | 577 | size_t sz; |
578 | 578 | ||
579 | if (!(ubifs_chk_flags & UBIFS_CHK_OLD_IDX)) | 579 | if (!dbg_is_chk_old_idx(c)) |
580 | return 0; | 580 | return 0; |
581 | 581 | ||
582 | INIT_LIST_HEAD(&list); | 582 | INIT_LIST_HEAD(&list); |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 7adf9fe91817..79d8924aca5b 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -330,7 +330,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node) | |||
330 | union ubifs_key key; | 330 | union ubifs_key key; |
331 | const struct ubifs_ch *ch = node; | 331 | const struct ubifs_ch *ch = node; |
332 | 332 | ||
333 | if (dbg_failure_mode) | 333 | if (dbg_is_tst_rcvry(c)) |
334 | return; | 334 | return; |
335 | 335 | ||
336 | /* If the magic is incorrect, just hexdump the first bytes */ | 336 | /* If the magic is incorrect, just hexdump the first bytes */ |
@@ -886,7 +886,7 @@ void dbg_dump_leb(const struct ubifs_info *c, int lnum) | |||
886 | struct ubifs_scan_node *snod; | 886 | struct ubifs_scan_node *snod; |
887 | void *buf; | 887 | void *buf; |
888 | 888 | ||
889 | if (dbg_failure_mode) | 889 | if (dbg_is_tst_rcvry(c)) |
890 | return; | 890 | return; |
891 | 891 | ||
892 | printk(KERN_DEBUG "(pid %d) start dumping LEB %d\n", | 892 | printk(KERN_DEBUG "(pid %d) start dumping LEB %d\n", |
@@ -1145,7 +1145,7 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode) | |||
1145 | int err = 0; | 1145 | int err = 0; |
1146 | struct ubifs_inode *ui = ubifs_inode(inode); | 1146 | struct ubifs_inode *ui = ubifs_inode(inode); |
1147 | 1147 | ||
1148 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 1148 | if (!dbg_is_chk_gen(c)) |
1149 | return 0; | 1149 | return 0; |
1150 | if (!S_ISREG(inode->i_mode)) | 1150 | if (!S_ISREG(inode->i_mode)) |
1151 | return 0; | 1151 | return 0; |
@@ -1186,7 +1186,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1186 | struct qstr nm = { .name = NULL }; | 1186 | struct qstr nm = { .name = NULL }; |
1187 | loff_t size = UBIFS_INO_NODE_SZ; | 1187 | loff_t size = UBIFS_INO_NODE_SZ; |
1188 | 1188 | ||
1189 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 1189 | if (!dbg_is_chk_gen(c)) |
1190 | return 0; | 1190 | return 0; |
1191 | 1191 | ||
1192 | if (!S_ISDIR(dir->i_mode)) | 1192 | if (!S_ISDIR(dir->i_mode)) |
@@ -1544,7 +1544,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) | |||
1544 | long clean_cnt = 0, dirty_cnt = 0; | 1544 | long clean_cnt = 0, dirty_cnt = 0; |
1545 | int err, last; | 1545 | int err, last; |
1546 | 1546 | ||
1547 | if (!(ubifs_chk_flags & UBIFS_CHK_TNC)) | 1547 | if (!dbg_is_chk_tnc(c)) |
1548 | return 0; | 1548 | return 0; |
1549 | 1549 | ||
1550 | ubifs_assert(mutex_is_locked(&c->tnc_mutex)); | 1550 | ubifs_assert(mutex_is_locked(&c->tnc_mutex)); |
@@ -1791,7 +1791,7 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size) | |||
1791 | int err; | 1791 | int err; |
1792 | long long calc = 0; | 1792 | long long calc = 0; |
1793 | 1793 | ||
1794 | if (!(ubifs_chk_flags & UBIFS_CHK_IDX_SZ)) | 1794 | if (!dbg_is_chk_idx_sz(c)) |
1795 | return 0; | 1795 | return 0; |
1796 | 1796 | ||
1797 | err = dbg_walk_index(c, NULL, add_size, &calc); | 1797 | err = dbg_walk_index(c, NULL, add_size, &calc); |
@@ -2367,7 +2367,7 @@ int dbg_check_filesystem(struct ubifs_info *c) | |||
2367 | int err; | 2367 | int err; |
2368 | struct fsck_data fsckd; | 2368 | struct fsck_data fsckd; |
2369 | 2369 | ||
2370 | if (!(ubifs_chk_flags & UBIFS_CHK_FS)) | 2370 | if (!dbg_is_chk_fs(c)) |
2371 | return 0; | 2371 | return 0; |
2372 | 2372 | ||
2373 | fsckd.inodes = RB_ROOT; | 2373 | fsckd.inodes = RB_ROOT; |
@@ -2402,7 +2402,7 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2402 | struct list_head *cur; | 2402 | struct list_head *cur; |
2403 | struct ubifs_scan_node *sa, *sb; | 2403 | struct ubifs_scan_node *sa, *sb; |
2404 | 2404 | ||
2405 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 2405 | if (!dbg_is_chk_gen(c)) |
2406 | return 0; | 2406 | return 0; |
2407 | 2407 | ||
2408 | for (cur = head->next; cur->next != head; cur = cur->next) { | 2408 | for (cur = head->next; cur->next != head; cur = cur->next) { |
@@ -2469,7 +2469,7 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2469 | struct list_head *cur; | 2469 | struct list_head *cur; |
2470 | struct ubifs_scan_node *sa, *sb; | 2470 | struct ubifs_scan_node *sa, *sb; |
2471 | 2471 | ||
2472 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 2472 | if (!dbg_is_chk_gen(c)) |
2473 | return 0; | 2473 | return 0; |
2474 | 2474 | ||
2475 | for (cur = head->next; cur->next != head; cur = cur->next) { | 2475 | for (cur = head->next; cur->next != head; cur = cur->next) { |
@@ -2546,14 +2546,6 @@ error_dump: | |||
2546 | return 0; | 2546 | return 0; |
2547 | } | 2547 | } |
2548 | 2548 | ||
2549 | int dbg_force_in_the_gaps(void) | ||
2550 | { | ||
2551 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | ||
2552 | return 0; | ||
2553 | |||
2554 | return !(random32() & 7); | ||
2555 | } | ||
2556 | |||
2557 | /* Failure mode for recovery testing */ | 2549 | /* Failure mode for recovery testing */ |
2558 | 2550 | ||
2559 | #define chance(n, d) (simple_rand() <= (n) * 32768LL / (d)) | 2551 | #define chance(n, d) (simple_rand() <= (n) * 32768LL / (d)) |
@@ -2624,7 +2616,7 @@ static int in_failure_mode(struct ubi_volume_desc *desc) | |||
2624 | { | 2616 | { |
2625 | struct ubifs_info *c = dbg_find_info(desc); | 2617 | struct ubifs_info *c = dbg_find_info(desc); |
2626 | 2618 | ||
2627 | if (c && dbg_failure_mode) | 2619 | if (c && dbg_is_tst_rcvry(c)) |
2628 | return c->dbg->failure_mode; | 2620 | return c->dbg->failure_mode; |
2629 | return 0; | 2621 | return 0; |
2630 | } | 2622 | } |
@@ -2634,7 +2626,7 @@ static int do_fail(struct ubi_volume_desc *desc, int lnum, int write) | |||
2634 | struct ubifs_info *c = dbg_find_info(desc); | 2626 | struct ubifs_info *c = dbg_find_info(desc); |
2635 | struct ubifs_debug_info *d; | 2627 | struct ubifs_debug_info *d; |
2636 | 2628 | ||
2637 | if (!c || !dbg_failure_mode) | 2629 | if (!c || !dbg_is_tst_rcvry(c)) |
2638 | return 0; | 2630 | return 0; |
2639 | d = c->dbg; | 2631 | d = c->dbg; |
2640 | if (d->failure_mode) | 2632 | if (d->failure_mode) |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 90805bd49456..c3d1ffd0610a 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -31,8 +31,6 @@ typedef int (*dbg_znode_callback)(struct ubifs_info *c, | |||
31 | 31 | ||
32 | #ifdef CONFIG_UBIFS_FS_DEBUG | 32 | #ifdef CONFIG_UBIFS_FS_DEBUG |
33 | 33 | ||
34 | #include <linux/random.h> | ||
35 | |||
36 | /* | 34 | /* |
37 | * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" | 35 | * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" |
38 | * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. | 36 | * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. |
@@ -169,6 +167,8 @@ const char *dbg_key_str1(const struct ubifs_info *c, | |||
169 | /* Additional recovery messages */ | 167 | /* Additional recovery messages */ |
170 | #define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__) | 168 | #define dbg_rcvry(fmt, ...) ubifs_dbg_msg("rcvry", fmt, ##__VA_ARGS__) |
171 | 169 | ||
170 | extern spinlock_t dbg_lock; | ||
171 | |||
172 | /* | 172 | /* |
173 | * Debugging check flags. | 173 | * Debugging check flags. |
174 | * | 174 | * |
@@ -199,12 +199,43 @@ enum { | |||
199 | UBIFS_TST_RCVRY = 0x4, | 199 | UBIFS_TST_RCVRY = 0x4, |
200 | }; | 200 | }; |
201 | 201 | ||
202 | extern spinlock_t dbg_lock; | ||
203 | |||
204 | extern unsigned int ubifs_msg_flags; | 202 | extern unsigned int ubifs_msg_flags; |
205 | extern unsigned int ubifs_chk_flags; | 203 | extern unsigned int ubifs_chk_flags; |
206 | extern unsigned int ubifs_tst_flags; | 204 | extern unsigned int ubifs_tst_flags; |
207 | 205 | ||
206 | static inline int dbg_is_chk_gen(const struct ubifs_info *c) | ||
207 | { | ||
208 | return !!(ubifs_chk_flags & UBIFS_CHK_GEN); | ||
209 | } | ||
210 | static inline int dbg_is_chk_tnc(const struct ubifs_info *c) | ||
211 | { | ||
212 | return !!(ubifs_chk_flags & UBIFS_CHK_TNC); | ||
213 | } | ||
214 | static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c) | ||
215 | { | ||
216 | return !!(ubifs_chk_flags & UBIFS_CHK_IDX_SZ); | ||
217 | } | ||
218 | static inline int dbg_is_chk_orph(const struct ubifs_info *c) | ||
219 | { | ||
220 | return !!(ubifs_chk_flags & UBIFS_CHK_ORPH); | ||
221 | } | ||
222 | static inline int dbg_is_chk_old_idx(const struct ubifs_info *c) | ||
223 | { | ||
224 | return !!(ubifs_chk_flags & UBIFS_CHK_OLD_IDX); | ||
225 | } | ||
226 | static inline int dbg_is_chk_lprops(const struct ubifs_info *c) | ||
227 | { | ||
228 | return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS); | ||
229 | } | ||
230 | static inline int dbg_is_chk_fs(const struct ubifs_info *c) | ||
231 | { | ||
232 | return !!(ubifs_chk_flags & UBIFS_CHK_FS); | ||
233 | } | ||
234 | static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) | ||
235 | { | ||
236 | return !!(ubifs_tst_flags & UBIFS_TST_RCVRY); | ||
237 | } | ||
238 | |||
208 | int ubifs_debugging_init(struct ubifs_info *c); | 239 | int ubifs_debugging_init(struct ubifs_info *c); |
209 | void ubifs_debugging_exit(struct ubifs_info *c); | 240 | void ubifs_debugging_exit(struct ubifs_info *c); |
210 | 241 | ||
@@ -261,16 +292,6 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode, | |||
261 | int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head); | 292 | int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head); |
262 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); | 293 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); |
263 | 294 | ||
264 | /* Force the use of in-the-gaps method for testing */ | ||
265 | static inline int dbg_force_in_the_gaps_enabled(void) | ||
266 | { | ||
267 | return ubifs_chk_flags & UBIFS_CHK_GEN; | ||
268 | } | ||
269 | int dbg_force_in_the_gaps(void); | ||
270 | |||
271 | /* Failure mode for recovery testing */ | ||
272 | #define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY) | ||
273 | |||
274 | #ifndef UBIFS_DBG_PRESERVE_UBI | 295 | #ifndef UBIFS_DBG_PRESERVE_UBI |
275 | #define ubi_leb_read dbg_leb_read | 296 | #define ubi_leb_read dbg_leb_read |
276 | #define ubi_leb_write dbg_leb_write | 297 | #define ubi_leb_write dbg_leb_write |
@@ -330,6 +351,9 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c); | |||
330 | ubifs_err(fmt, ##__VA_ARGS__); \ | 351 | ubifs_err(fmt, ##__VA_ARGS__); \ |
331 | } while (0) | 352 | } while (0) |
332 | 353 | ||
354 | #define DBGKEY(key) ((char *)(key)) | ||
355 | #define DBGKEY1(key) ((char *)(key)) | ||
356 | |||
333 | #define ubifs_dbg_msg(fmt, ...) do { \ | 357 | #define ubifs_dbg_msg(fmt, ...) do { \ |
334 | if (0) \ | 358 | if (0) \ |
335 | pr_debug(fmt "\n", ##__VA_ARGS__); \ | 359 | pr_debug(fmt "\n", ##__VA_ARGS__); \ |
@@ -353,9 +377,6 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c); | |||
353 | #define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | 377 | #define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) |
354 | #define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | 378 | #define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) |
355 | 379 | ||
356 | #define DBGKEY(key) ((char *)(key)) | ||
357 | #define DBGKEY1(key) ((char *)(key)) | ||
358 | |||
359 | static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; } | 380 | static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; } |
360 | static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; } | 381 | static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; } |
361 | static inline const char *dbg_ntype(int type) { return ""; } | 382 | static inline const char *dbg_ntype(int type) { return ""; } |
@@ -440,9 +461,14 @@ static inline int | |||
440 | dbg_check_nondata_nodes_order(struct ubifs_info *c, | 461 | dbg_check_nondata_nodes_order(struct ubifs_info *c, |
441 | struct list_head *head) { return 0; } | 462 | struct list_head *head) { return 0; } |
442 | 463 | ||
443 | static inline int dbg_force_in_the_gaps(void) { return 0; } | 464 | static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; } |
444 | #define dbg_force_in_the_gaps_enabled() 0 | 465 | static inline int dbg_is_chk_tnc(const struct ubifs_info *c) { return 0; } |
445 | #define dbg_failure_mode 0 | 466 | static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c) { return 0; } |
467 | static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; } | ||
468 | static inline int dbg_is_chk_old_idx(const struct ubifs_info *c) { return 0; } | ||
469 | static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; } | ||
470 | static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; } | ||
471 | static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; } | ||
446 | 472 | ||
447 | static inline int dbg_debugfs_init(void) { return 0; } | 473 | static inline int dbg_debugfs_init(void) { return 0; } |
448 | static inline void dbg_debugfs_exit(void) { return; } | 474 | static inline void dbg_debugfs_exit(void) { return; } |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 98014bf1d8b4..683492043317 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -176,7 +176,7 @@ static int dbg_check_name(const struct ubifs_info *c, | |||
176 | const struct ubifs_dent_node *dent, | 176 | const struct ubifs_dent_node *dent, |
177 | const struct qstr *nm) | 177 | const struct qstr *nm) |
178 | { | 178 | { |
179 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 179 | if (!dbg_is_chk_gen(c)) |
180 | return 0; | 180 | return 0; |
181 | if (le16_to_cpu(dent->nlen) != nm->len) | 181 | if (le16_to_cpu(dent->nlen) != nm->len) |
182 | return -EINVAL; | 182 | return -EINVAL; |
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index affea9494ae2..fabfb53c4fee 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -752,7 +752,7 @@ static int dbg_check_bud_bytes(struct ubifs_info *c) | |||
752 | struct ubifs_bud *bud; | 752 | struct ubifs_bud *bud; |
753 | long long bud_bytes = 0; | 753 | long long bud_bytes = 0; |
754 | 754 | ||
755 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 755 | if (!dbg_is_chk_gen(c)) |
756 | return 0; | 756 | return 0; |
757 | 757 | ||
758 | spin_lock(&c->buds_lock); | 758 | spin_lock(&c->buds_lock); |
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index 98b8e73c454c..f8a181e647cc 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c | |||
@@ -860,7 +860,7 @@ int dbg_check_cats(struct ubifs_info *c) | |||
860 | struct list_head *pos; | 860 | struct list_head *pos; |
861 | int i, cat; | 861 | int i, cat; |
862 | 862 | ||
863 | if (!(ubifs_chk_flags & (UBIFS_CHK_GEN | UBIFS_CHK_LPROPS))) | 863 | if (!dbg_is_chk_gen(c) && !dbg_is_chk_lprops(c)) |
864 | return 0; | 864 | return 0; |
865 | 865 | ||
866 | list_for_each_entry(lprops, &c->empty_list, list) { | 866 | list_for_each_entry(lprops, &c->empty_list, list) { |
@@ -958,7 +958,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, | |||
958 | { | 958 | { |
959 | int i = 0, j, err = 0; | 959 | int i = 0, j, err = 0; |
960 | 960 | ||
961 | if (!(ubifs_chk_flags & (UBIFS_CHK_GEN | UBIFS_CHK_LPROPS))) | 961 | if (!dbg_is_chk_gen(c) && !dbg_is_chk_lprops(c)) |
962 | return; | 962 | return; |
963 | 963 | ||
964 | for (i = 0; i < heap->cnt; i++) { | 964 | for (i = 0; i < heap->cnt; i++) { |
@@ -1262,7 +1262,7 @@ int dbg_check_lprops(struct ubifs_info *c) | |||
1262 | int i, err; | 1262 | int i, err; |
1263 | struct ubifs_lp_stats lst; | 1263 | struct ubifs_lp_stats lst; |
1264 | 1264 | ||
1265 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1265 | if (!dbg_is_chk_lprops(c)) |
1266 | return 0; | 1266 | return 0; |
1267 | 1267 | ||
1268 | /* | 1268 | /* |
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index 04713cd22679..ab91ca628455 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -2226,7 +2226,7 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, | |||
2226 | struct ubifs_cnode *cn; | 2226 | struct ubifs_cnode *cn; |
2227 | int num, iip = 0, err; | 2227 | int num, iip = 0, err; |
2228 | 2228 | ||
2229 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 2229 | if (!dbg_is_chk_lprops(c)) |
2230 | return 0; | 2230 | return 0; |
2231 | 2231 | ||
2232 | while (cnode) { | 2232 | while (cnode) { |
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 254e8d32fc67..f8e286ba8095 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -1640,7 +1640,7 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) | |||
1640 | int ret; | 1640 | int ret; |
1641 | void *buf, *p; | 1641 | void *buf, *p; |
1642 | 1642 | ||
1643 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1643 | if (!dbg_is_chk_lprops(c)) |
1644 | return 0; | 1644 | return 0; |
1645 | 1645 | ||
1646 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 1646 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
@@ -1711,7 +1711,7 @@ int dbg_check_ltab(struct ubifs_info *c) | |||
1711 | { | 1711 | { |
1712 | int lnum, err, i, cnt; | 1712 | int lnum, err, i, cnt; |
1713 | 1713 | ||
1714 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1714 | if (!dbg_is_chk_lprops(c)) |
1715 | return 0; | 1715 | return 0; |
1716 | 1716 | ||
1717 | /* Bring the entire tree into memory */ | 1717 | /* Bring the entire tree into memory */ |
@@ -1754,7 +1754,7 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c) | |||
1754 | long long free = 0; | 1754 | long long free = 0; |
1755 | int i; | 1755 | int i; |
1756 | 1756 | ||
1757 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1757 | if (!dbg_is_chk_lprops(c)) |
1758 | return 0; | 1758 | return 0; |
1759 | 1759 | ||
1760 | for (i = 0; i < c->lpt_lebs; i++) { | 1760 | for (i = 0; i < c->lpt_lebs; i++) { |
@@ -1796,7 +1796,7 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1796 | long long chk_lpt_sz, lpt_sz; | 1796 | long long chk_lpt_sz, lpt_sz; |
1797 | int err = 0; | 1797 | int err = 0; |
1798 | 1798 | ||
1799 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1799 | if (!dbg_is_chk_lprops(c)) |
1800 | return 0; | 1800 | return 0; |
1801 | 1801 | ||
1802 | switch (action) { | 1802 | switch (action) { |
@@ -2019,7 +2019,7 @@ static int dbg_populate_lsave(struct ubifs_info *c) | |||
2019 | struct ubifs_lpt_heap *heap; | 2019 | struct ubifs_lpt_heap *heap; |
2020 | int i; | 2020 | int i; |
2021 | 2021 | ||
2022 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 2022 | if (!dbg_is_chk_gen(c)) |
2023 | return 0; | 2023 | return 0; |
2024 | if (random32() & 3) | 2024 | if (random32() & 3) |
2025 | return 0; | 2025 | return 0; |
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index a5422fffbd69..c542c73cfa3c 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -929,7 +929,7 @@ static int dbg_check_orphans(struct ubifs_info *c) | |||
929 | struct check_info ci; | 929 | struct check_info ci; |
930 | int err; | 930 | int err; |
931 | 931 | ||
932 | if (!(ubifs_chk_flags & UBIFS_CHK_ORPH)) | 932 | if (!dbg_is_chk_orph(c)) |
933 | return 0; | 933 | return 0; |
934 | 934 | ||
935 | ci.last_ino = 0; | 935 | ci.last_ino = 0; |
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c index 36216b46f772..c7df916dce97 100644 --- a/fs/ubifs/scan.c +++ b/fs/ubifs/scan.c | |||
@@ -240,7 +240,7 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, | |||
240 | int len; | 240 | int len; |
241 | 241 | ||
242 | ubifs_err("corruption at LEB %d:%d", lnum, offs); | 242 | ubifs_err("corruption at LEB %d:%d", lnum, offs); |
243 | if (dbg_failure_mode) | 243 | if (dbg_is_tst_rcvry(c)) |
244 | return; | 244 | return; |
245 | len = c->leb_size - offs; | 245 | len = c->leb_size - offs; |
246 | if (len > 8192) | 246 | if (len > 8192) |
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index b32a5376b7b4..526b63cd3333 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -3300,7 +3300,7 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode, | |||
3300 | 3300 | ||
3301 | if (!S_ISREG(inode->i_mode)) | 3301 | if (!S_ISREG(inode->i_mode)) |
3302 | return 0; | 3302 | return 0; |
3303 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 3303 | if (!dbg_is_chk_gen(c)) |
3304 | return 0; | 3304 | return 0; |
3305 | 3305 | ||
3306 | block = (size + UBIFS_BLOCK_SIZE - 1) >> UBIFS_BLOCK_SHIFT; | 3306 | block = (size + UBIFS_BLOCK_SIZE - 1) >> UBIFS_BLOCK_SHIFT; |
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index d6fab1a9986c..8959c726b024 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -23,6 +23,7 @@ | |||
23 | /* This file implements TNC functions for committing */ | 23 | /* This file implements TNC functions for committing */ |
24 | 24 | ||
25 | #include "ubifs.h" | 25 | #include "ubifs.h" |
26 | #include <linux/random.h> | ||
26 | 27 | ||
27 | /** | 28 | /** |
28 | * make_idx_node - make an index node for fill-the-gaps method of TNC commit. | 29 | * make_idx_node - make an index node for fill-the-gaps method of TNC commit. |
@@ -381,7 +382,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) | |||
381 | c->gap_lebs = NULL; | 382 | c->gap_lebs = NULL; |
382 | return err; | 383 | return err; |
383 | } | 384 | } |
384 | if (dbg_force_in_the_gaps_enabled()) { | 385 | if (!dbg_is_chk_gen(c)) { |
385 | /* | 386 | /* |
386 | * Do not print scary warnings if the debugging | 387 | * Do not print scary warnings if the debugging |
387 | * option which forces in-the-gaps is enabled. | 388 | * option which forces in-the-gaps is enabled. |
@@ -689,7 +690,7 @@ static int alloc_idx_lebs(struct ubifs_info *c, int cnt) | |||
689 | c->ilebs[c->ileb_cnt++] = lnum; | 690 | c->ilebs[c->ileb_cnt++] = lnum; |
690 | dbg_cmt("LEB %d", lnum); | 691 | dbg_cmt("LEB %d", lnum); |
691 | } | 692 | } |
692 | if (dbg_force_in_the_gaps()) | 693 | if (dbg_is_chk_gen(c) && !(random32() & 7)) |
693 | return -ENOSPC; | 694 | return -ENOSPC; |
694 | return 0; | 695 | return 0; |
695 | } | 696 | } |