diff options
Diffstat (limited to 'fs/ubifs/debug.c')
-rw-r--r-- | fs/ubifs/debug.c | 30 |
1 files changed, 11 insertions, 19 deletions
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) |