diff options
| -rw-r--r-- | Documentation/filesystems/ubifs.txt | 1 | ||||
| -rw-r--r-- | fs/ubifs/debug.c | 9 | ||||
| -rw-r--r-- | fs/ubifs/debug.h | 19 | ||||
| -rw-r--r-- | fs/ubifs/tnc_commit.c | 4 |
4 files changed, 13 insertions, 20 deletions
diff --git a/Documentation/filesystems/ubifs.txt b/Documentation/filesystems/ubifs.txt index d7b13b01e980..7d17e5b91ff4 100644 --- a/Documentation/filesystems/ubifs.txt +++ b/Documentation/filesystems/ubifs.txt | |||
| @@ -154,7 +154,6 @@ debug_tsts Selects a mode of testing, as follows: | |||
| 154 | 154 | ||
| 155 | Test mode Flag value | 155 | Test mode Flag value |
| 156 | 156 | ||
| 157 | Force in-the-gaps method 2 | ||
| 158 | Failure mode for recovery testing 4 | 157 | Failure mode for recovery testing 4 |
| 159 | 158 | ||
| 160 | For example, set debug_msgs to 5 to display General messages and Mount | 159 | For example, set debug_msgs to 5 to display General messages and Mount |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 546ad575b660..06d171cefe45 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
| 35 | #include <linux/debugfs.h> | 35 | #include <linux/debugfs.h> |
| 36 | #include <linux/math64.h> | 36 | #include <linux/math64.h> |
| 37 | #include <linux/slab.h> | ||
| 38 | 37 | ||
| 39 | #ifdef CONFIG_UBIFS_FS_DEBUG | 38 | #ifdef CONFIG_UBIFS_FS_DEBUG |
| 40 | 39 | ||
| @@ -2458,14 +2457,12 @@ error_dump: | |||
| 2458 | return 0; | 2457 | return 0; |
| 2459 | } | 2458 | } |
| 2460 | 2459 | ||
| 2461 | static int invocation_cnt; | ||
| 2462 | |||
| 2463 | int dbg_force_in_the_gaps(void) | 2460 | int dbg_force_in_the_gaps(void) |
| 2464 | { | 2461 | { |
| 2465 | if (!dbg_force_in_the_gaps_enabled) | 2462 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) |
| 2466 | return 0; | 2463 | return 0; |
| 2467 | /* Force in-the-gaps every 8th commit */ | 2464 | |
| 2468 | return !((invocation_cnt++) & 0x7); | 2465 | return !(random32() & 7); |
| 2469 | } | 2466 | } |
| 2470 | 2467 | ||
| 2471 | /* Failure mode for recovery testing */ | 2468 | /* Failure mode for recovery testing */ |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 6b5fe7ba0296..8934c12f108e 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
| @@ -31,6 +31,8 @@ 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 | |||
| 34 | /** | 36 | /** |
| 35 | * ubifs_debug_info - per-FS debugging information. | 37 | * ubifs_debug_info - per-FS debugging information. |
| 36 | * @old_zroot: old index root - used by 'dbg_check_old_index()' | 38 | * @old_zroot: old index root - used by 'dbg_check_old_index()' |
| @@ -237,11 +239,9 @@ enum { | |||
| 237 | /* | 239 | /* |
| 238 | * Special testing flags. | 240 | * Special testing flags. |
| 239 | * | 241 | * |
| 240 | * UBIFS_TST_FORCE_IN_THE_GAPS: force the use of in-the-gaps method | ||
| 241 | * UBIFS_TST_RCVRY: failure mode for recovery testing | 242 | * UBIFS_TST_RCVRY: failure mode for recovery testing |
| 242 | */ | 243 | */ |
| 243 | enum { | 244 | enum { |
| 244 | UBIFS_TST_FORCE_IN_THE_GAPS = 0x2, | ||
| 245 | UBIFS_TST_RCVRY = 0x4, | 245 | UBIFS_TST_RCVRY = 0x4, |
| 246 | }; | 246 | }; |
| 247 | 247 | ||
| @@ -308,18 +308,16 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head); | |||
| 308 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); | 308 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); |
| 309 | 309 | ||
| 310 | /* Force the use of in-the-gaps method for testing */ | 310 | /* Force the use of in-the-gaps method for testing */ |
| 311 | 311 | static inline int dbg_force_in_the_gaps_enabled(void) | |
| 312 | #define dbg_force_in_the_gaps_enabled \ | 312 | { |
| 313 | (ubifs_tst_flags & UBIFS_TST_FORCE_IN_THE_GAPS) | 313 | return ubifs_chk_flags & UBIFS_CHK_GEN; |
| 314 | 314 | } | |
| 315 | int dbg_force_in_the_gaps(void); | 315 | int dbg_force_in_the_gaps(void); |
| 316 | 316 | ||
| 317 | /* Failure mode for recovery testing */ | 317 | /* Failure mode for recovery testing */ |
| 318 | |||
| 319 | #define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY) | 318 | #define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY) |
| 320 | 319 | ||
| 321 | #ifndef UBIFS_DBG_PRESERVE_UBI | 320 | #ifndef UBIFS_DBG_PRESERVE_UBI |
| 322 | |||
| 323 | #define ubi_leb_read dbg_leb_read | 321 | #define ubi_leb_read dbg_leb_read |
| 324 | #define ubi_leb_write dbg_leb_write | 322 | #define ubi_leb_write dbg_leb_write |
| 325 | #define ubi_leb_change dbg_leb_change | 323 | #define ubi_leb_change dbg_leb_change |
| @@ -327,7 +325,6 @@ int dbg_force_in_the_gaps(void); | |||
| 327 | #define ubi_leb_unmap dbg_leb_unmap | 325 | #define ubi_leb_unmap dbg_leb_unmap |
| 328 | #define ubi_is_mapped dbg_is_mapped | 326 | #define ubi_is_mapped dbg_is_mapped |
| 329 | #define ubi_leb_map dbg_leb_map | 327 | #define ubi_leb_map dbg_leb_map |
| 330 | |||
| 331 | #endif | 328 | #endif |
| 332 | 329 | ||
| 333 | int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, | 330 | int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, |
| @@ -488,8 +485,8 @@ dbg_check_nondata_nodes_order(struct ubifs_info *c, | |||
| 488 | struct list_head *head) { return 0; } | 485 | struct list_head *head) { return 0; } |
| 489 | 486 | ||
| 490 | static inline int dbg_force_in_the_gaps(void) { return 0; } | 487 | static inline int dbg_force_in_the_gaps(void) { return 0; } |
| 491 | #define dbg_force_in_the_gaps_enabled 0 | 488 | #define dbg_force_in_the_gaps_enabled() 0 |
| 492 | #define dbg_failure_mode 0 | 489 | #define dbg_failure_mode 0 |
| 493 | 490 | ||
| 494 | static inline int dbg_debugfs_init(void) { return 0; } | 491 | static inline int dbg_debugfs_init(void) { return 0; } |
| 495 | static inline void dbg_debugfs_exit(void) { return; } | 492 | static inline void dbg_debugfs_exit(void) { return; } |
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index c471b06798c8..41920f357bbf 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
| @@ -377,12 +377,12 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) | |||
| 377 | c->gap_lebs = NULL; | 377 | c->gap_lebs = NULL; |
| 378 | return err; | 378 | return err; |
| 379 | } | 379 | } |
| 380 | if (!dbg_force_in_the_gaps_enabled) { | 380 | if (dbg_force_in_the_gaps_enabled()) { |
| 381 | /* | 381 | /* |
| 382 | * Do not print scary warnings if the debugging | 382 | * Do not print scary warnings if the debugging |
| 383 | * option which forces in-the-gaps is enabled. | 383 | * option which forces in-the-gaps is enabled. |
| 384 | */ | 384 | */ |
| 385 | ubifs_err("out of space"); | 385 | ubifs_warn("out of space"); |
| 386 | dbg_dump_budg(c, &c->bi); | 386 | dbg_dump_budg(c, &c->bi); |
| 387 | dbg_dump_lprops(c); | 387 | dbg_dump_lprops(c); |
| 388 | } | 388 | } |
