Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250424
b: refs/heads/master
c: bc3f07f
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed May 13, 2011
1 parent 2d85ecf commit 6a90712
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f1bd66afb14c25095cf6ff499c1388db423acc9e
refs/heads/master: bc3f07f0906e867270fdc2006b0bbcb130a722c1
1 change: 0 additions & 1 deletion trunk/Documentation/filesystems/ubifs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ debug_tsts Selects a mode of testing, as follows:

Test mode Flag value

Force in-the-gaps method 2
Failure mode for recovery testing 4

For example, set debug_msgs to 5 to display General messages and Mount
Expand Down
9 changes: 3 additions & 6 deletions trunk/fs/ubifs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/moduleparam.h>
#include <linux/debugfs.h>
#include <linux/math64.h>
#include <linux/slab.h>

#ifdef CONFIG_UBIFS_FS_DEBUG

Expand Down Expand Up @@ -2458,14 +2457,12 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head)
return 0;
}

static int invocation_cnt;

int dbg_force_in_the_gaps(void)
{
if (!dbg_force_in_the_gaps_enabled)
if (!(ubifs_chk_flags & UBIFS_CHK_GEN))
return 0;
/* Force in-the-gaps every 8th commit */
return !((invocation_cnt++) & 0x7);

return !(random32() & 7);
}

/* Failure mode for recovery testing */
Expand Down
19 changes: 8 additions & 11 deletions trunk/fs/ubifs/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ typedef int (*dbg_znode_callback)(struct ubifs_info *c,

#ifdef CONFIG_UBIFS_FS_DEBUG

#include <linux/random.h>

/**
* ubifs_debug_info - per-FS debugging information.
* @old_zroot: old index root - used by 'dbg_check_old_index()'
Expand Down Expand Up @@ -237,11 +239,9 @@ enum {
/*
* Special testing flags.
*
* UBIFS_TST_FORCE_IN_THE_GAPS: force the use of in-the-gaps method
* UBIFS_TST_RCVRY: failure mode for recovery testing
*/
enum {
UBIFS_TST_FORCE_IN_THE_GAPS = 0x2,
UBIFS_TST_RCVRY = 0x4,
};

Expand Down Expand Up @@ -308,26 +308,23 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head);
int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head);

/* Force the use of in-the-gaps method for testing */

#define dbg_force_in_the_gaps_enabled \
(ubifs_tst_flags & UBIFS_TST_FORCE_IN_THE_GAPS)

static inline int dbg_force_in_the_gaps_enabled(void)
{
return ubifs_chk_flags & UBIFS_CHK_GEN;
}
int dbg_force_in_the_gaps(void);

/* Failure mode for recovery testing */

#define dbg_failure_mode (ubifs_tst_flags & UBIFS_TST_RCVRY)

#ifndef UBIFS_DBG_PRESERVE_UBI

#define ubi_leb_read dbg_leb_read
#define ubi_leb_write dbg_leb_write
#define ubi_leb_change dbg_leb_change
#define ubi_leb_erase dbg_leb_erase
#define ubi_leb_unmap dbg_leb_unmap
#define ubi_is_mapped dbg_is_mapped
#define ubi_leb_map dbg_leb_map

#endif

int dbg_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
Expand Down Expand Up @@ -488,8 +485,8 @@ dbg_check_nondata_nodes_order(struct ubifs_info *c,
struct list_head *head) { return 0; }

static inline int dbg_force_in_the_gaps(void) { return 0; }
#define dbg_force_in_the_gaps_enabled 0
#define dbg_failure_mode 0
#define dbg_force_in_the_gaps_enabled() 0
#define dbg_failure_mode 0

static inline int dbg_debugfs_init(void) { return 0; }
static inline void dbg_debugfs_exit(void) { return; }
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/ubifs/tnc_commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,12 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
c->gap_lebs = NULL;
return err;
}
if (!dbg_force_in_the_gaps_enabled) {
if (dbg_force_in_the_gaps_enabled()) {
/*
* Do not print scary warnings if the debugging
* option which forces in-the-gaps is enabled.
*/
ubifs_err("out of space");
ubifs_warn("out of space");
dbg_dump_budg(c, &c->bi);
dbg_dump_lprops(c);
}
Expand Down

0 comments on commit 6a90712

Please sign in to comment.