Commit 8d7819b4 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by Artem Bityutskiy

UBIFS: lessen amount of debugging check types

We have too many different debugging checks - lessen the amount by merging all
index-related checks into one. At the same time, move the "force in-the-gap"
test to the "index checks" class, because it is too heavy for the "general"
class.

This patch merges TNC, Old index, and Index size check and calles this just
"index checks".
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent 2b1844a8
...@@ -123,10 +123,8 @@ debug_chks Selects extra checks that UBIFS can do while running: ...@@ -123,10 +123,8 @@ debug_chks Selects extra checks that UBIFS can do while running:
Check Flag value Check Flag value
General checks 1 General checks 1
Check Tree Node Cache (TNC) 2 Check the index 2
Check indexing tree size 4
Check orphan area 8 Check orphan area 8
Check old indexing tree 16
Check LEB properties (lprops) 32 Check LEB properties (lprops) 32
Check leaf nodes and inodes 64 Check leaf nodes and inodes 64
......
...@@ -576,7 +576,7 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot) ...@@ -576,7 +576,7 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
struct idx_node *i; struct idx_node *i;
size_t sz; size_t sz;
if (!dbg_is_chk_old_idx(c)) if (!dbg_is_chk_index(c))
return 0; return 0;
INIT_LIST_HEAD(&list); INIT_LIST_HEAD(&list);
......
...@@ -1544,7 +1544,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) ...@@ -1544,7 +1544,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra)
long clean_cnt = 0, dirty_cnt = 0; long clean_cnt = 0, dirty_cnt = 0;
int err, last; int err, last;
if (!dbg_is_chk_tnc(c)) if (!dbg_is_chk_index(c))
return 0; return 0;
ubifs_assert(mutex_is_locked(&c->tnc_mutex)); 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,7 +1791,7 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size)
int err; int err;
long long calc = 0; long long calc = 0;
if (!dbg_is_chk_idx_sz(c)) if (!dbg_is_chk_index(c))
return 0; return 0;
err = dbg_walk_index(c, NULL, add_size, &calc); err = dbg_walk_index(c, NULL, add_size, &calc);
......
...@@ -173,19 +173,15 @@ extern spinlock_t dbg_lock; ...@@ -173,19 +173,15 @@ extern spinlock_t dbg_lock;
* Debugging check flags. * Debugging check flags.
* *
* UBIFS_CHK_GEN: general checks * UBIFS_CHK_GEN: general checks
* UBIFS_CHK_TNC: check TNC * UBIFS_CHK_INDEX: check the index
* UBIFS_CHK_IDX_SZ: check index size
* UBIFS_CHK_ORPH: check orphans * UBIFS_CHK_ORPH: check orphans
* UBIFS_CHK_OLD_IDX: check the old index
* UBIFS_CHK_LPROPS: check lprops * UBIFS_CHK_LPROPS: check lprops
* UBIFS_CHK_FS: check the file-system * UBIFS_CHK_FS: check the file-system
*/ */
enum { enum {
UBIFS_CHK_GEN = 0x1, UBIFS_CHK_GEN = 0x1,
UBIFS_CHK_TNC = 0x2, UBIFS_CHK_INDEX = 0x2,
UBIFS_CHK_IDX_SZ = 0x4,
UBIFS_CHK_ORPH = 0x8, UBIFS_CHK_ORPH = 0x8,
UBIFS_CHK_OLD_IDX = 0x10,
UBIFS_CHK_LPROPS = 0x20, UBIFS_CHK_LPROPS = 0x20,
UBIFS_CHK_FS = 0x40, UBIFS_CHK_FS = 0x40,
}; };
...@@ -207,22 +203,14 @@ static inline int dbg_is_chk_gen(const struct ubifs_info *c) ...@@ -207,22 +203,14 @@ static inline int dbg_is_chk_gen(const struct ubifs_info *c)
{ {
return !!(ubifs_chk_flags & UBIFS_CHK_GEN); return !!(ubifs_chk_flags & UBIFS_CHK_GEN);
} }
static inline int dbg_is_chk_tnc(const struct ubifs_info *c) static inline int dbg_is_chk_index(const struct ubifs_info *c)
{ {
return !!(ubifs_chk_flags & UBIFS_CHK_TNC); return !!(ubifs_chk_flags & UBIFS_CHK_INDEX);
}
static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c)
{
return !!(ubifs_chk_flags & UBIFS_CHK_IDX_SZ);
} }
static inline int dbg_is_chk_orph(const struct ubifs_info *c) static inline int dbg_is_chk_orph(const struct ubifs_info *c)
{ {
return !!(ubifs_chk_flags & UBIFS_CHK_ORPH); return !!(ubifs_chk_flags & UBIFS_CHK_ORPH);
} }
static inline int dbg_is_chk_old_idx(const struct ubifs_info *c)
{
return !!(ubifs_chk_flags & UBIFS_CHK_OLD_IDX);
}
static inline int dbg_is_chk_lprops(const struct ubifs_info *c) static inline int dbg_is_chk_lprops(const struct ubifs_info *c)
{ {
return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS); return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS);
...@@ -462,10 +450,8 @@ dbg_check_nondata_nodes_order(struct ubifs_info *c, ...@@ -462,10 +450,8 @@ dbg_check_nondata_nodes_order(struct ubifs_info *c,
struct list_head *head) { return 0; } struct list_head *head) { return 0; }
static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; } static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; }
static inline int dbg_is_chk_tnc(const struct ubifs_info *c) { return 0; } static inline int dbg_is_chk_index(const struct ubifs_info *c) { return 0; }
static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c) { return 0; }
static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; } static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; }
static inline int dbg_is_chk_old_idx(const struct ubifs_info *c) { return 0; }
static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; } static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; }
static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; } static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; }
static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; } static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/crc16.h> #include <linux/crc16.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/random.h>
#include "ubifs.h" #include "ubifs.h"
#ifdef CONFIG_UBIFS_FS_DEBUG #ifdef CONFIG_UBIFS_FS_DEBUG
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
/* This file implements TNC functions for committing */ /* This file implements TNC functions for committing */
#include "ubifs.h"
#include <linux/random.h> #include <linux/random.h>
#include "ubifs.h"
/** /**
* make_idx_node - make an index node for fill-the-gaps method of TNC commit. * make_idx_node - make an index node for fill-the-gaps method of TNC commit.
...@@ -382,7 +382,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) ...@@ -382,7 +382,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
c->gap_lebs = NULL; c->gap_lebs = NULL;
return err; return err;
} }
if (!dbg_is_chk_gen(c)) { if (!dbg_is_chk_index(c)) {
/* /*
* Do not print scary warnings if the debugging * Do not print scary warnings if the debugging
* option which forces in-the-gaps is enabled. * option which forces in-the-gaps is enabled.
...@@ -690,7 +690,7 @@ static int alloc_idx_lebs(struct ubifs_info *c, int cnt) ...@@ -690,7 +690,7 @@ static int alloc_idx_lebs(struct ubifs_info *c, int cnt)
c->ilebs[c->ileb_cnt++] = lnum; c->ilebs[c->ileb_cnt++] = lnum;
dbg_cmt("LEB %d", lnum); dbg_cmt("LEB %d", lnum);
} }
if (dbg_is_chk_gen(c) && !(random32() & 7)) if (dbg_is_chk_index(c) && !(random32() & 7))
return -ENOSPC; return -ENOSPC;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment