Skip to content

Commit 8d7819b

Browse files
Artem Bityutskiydedekind
authored andcommitted
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: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
1 parent 2b1844a commit 8d7819b

6 files changed

Lines changed: 13 additions & 28 deletions

File tree

‎Documentation/filesystems/ubifs.txt‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,8 @@ debug_chks Selects extra checks that UBIFS can do while running:
123123
Check Flag value
124124

125125
General checks 1
126-
Check Tree Node Cache (TNC) 2
127-
Check indexing tree size 4
126+
Check the index 2
128127
Check orphan area 8
129-
Check old indexing tree 16
130128
Check LEB properties (lprops) 32
131129
Check leaf nodes and inodes 64
132130

‎fs/ubifs/commit.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
576576
struct idx_node *i;
577577
size_t sz;
578578

579-
if (!dbg_is_chk_old_idx(c))
579+
if (!dbg_is_chk_index(c))
580580
return 0;
581581

582582
INIT_LIST_HEAD(&list);

‎fs/ubifs/debug.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra)
15441544
long clean_cnt = 0, dirty_cnt = 0;
15451545
int err, last;
15461546

1547-
if (!dbg_is_chk_tnc(c))
1547+
if (!dbg_is_chk_index(c))
15481548
return 0;
15491549

15501550
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)
17911791
int err;
17921792
long long calc = 0;
17931793

1794-
if (!dbg_is_chk_idx_sz(c))
1794+
if (!dbg_is_chk_index(c))
17951795
return 0;
17961796

17971797
err = dbg_walk_index(c, NULL, add_size, &calc);

‎fs/ubifs/debug.h‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,15 @@ extern spinlock_t dbg_lock;
173173
* Debugging check flags.
174174
*
175175
* UBIFS_CHK_GEN: general checks
176-
* UBIFS_CHK_TNC: check TNC
177-
* UBIFS_CHK_IDX_SZ: check index size
176+
* UBIFS_CHK_INDEX: check the index
178177
* UBIFS_CHK_ORPH: check orphans
179-
* UBIFS_CHK_OLD_IDX: check the old index
180178
* UBIFS_CHK_LPROPS: check lprops
181179
* UBIFS_CHK_FS: check the file-system
182180
*/
183181
enum {
184182
UBIFS_CHK_GEN = 0x1,
185-
UBIFS_CHK_TNC = 0x2,
186-
UBIFS_CHK_IDX_SZ = 0x4,
183+
UBIFS_CHK_INDEX = 0x2,
187184
UBIFS_CHK_ORPH = 0x8,
188-
UBIFS_CHK_OLD_IDX = 0x10,
189185
UBIFS_CHK_LPROPS = 0x20,
190186
UBIFS_CHK_FS = 0x40,
191187
};
@@ -207,22 +203,14 @@ static inline int dbg_is_chk_gen(const struct ubifs_info *c)
207203
{
208204
return !!(ubifs_chk_flags & UBIFS_CHK_GEN);
209205
}
210-
static inline int dbg_is_chk_tnc(const struct ubifs_info *c)
206+
static inline int dbg_is_chk_index(const struct ubifs_info *c)
211207
{
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);
208+
return !!(ubifs_chk_flags & UBIFS_CHK_INDEX);
217209
}
218210
static inline int dbg_is_chk_orph(const struct ubifs_info *c)
219211
{
220212
return !!(ubifs_chk_flags & UBIFS_CHK_ORPH);
221213
}
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-
}
226214
static inline int dbg_is_chk_lprops(const struct ubifs_info *c)
227215
{
228216
return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS);
@@ -462,10 +450,8 @@ dbg_check_nondata_nodes_order(struct ubifs_info *c,
462450
struct list_head *head) { return 0; }
463451

464452
static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; }
465-
static inline int dbg_is_chk_tnc(const struct ubifs_info *c) { return 0; }
466-
static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c) { return 0; }
453+
static inline int dbg_is_chk_index(const struct ubifs_info *c) { return 0; }
467454
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; }
469455
static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; }
470456
static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; }
471457
static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; }

‎fs/ubifs/lpt_commit.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include <linux/crc16.h>
2929
#include <linux/slab.h>
30+
#include <linux/random.h>
3031
#include "ubifs.h"
3132

3233
#ifdef CONFIG_UBIFS_FS_DEBUG

‎fs/ubifs/tnc_commit.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
/* This file implements TNC functions for committing */
2424

25-
#include "ubifs.h"
2625
#include <linux/random.h>
26+
#include "ubifs.h"
2727

2828
/**
2929
* 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)
382382
c->gap_lebs = NULL;
383383
return err;
384384
}
385-
if (!dbg_is_chk_gen(c)) {
385+
if (!dbg_is_chk_index(c)) {
386386
/*
387387
* Do not print scary warnings if the debugging
388388
* option which forces in-the-gaps is enabled.
@@ -690,7 +690,7 @@ static int alloc_idx_lebs(struct ubifs_info *c, int cnt)
690690
c->ilebs[c->ileb_cnt++] = lnum;
691691
dbg_cmt("LEB %d", lnum);
692692
}
693-
if (dbg_is_chk_gen(c) && !(random32() & 7))
693+
if (dbg_is_chk_index(c) && !(random32() & 7))
694694
return -ENOSPC;
695695
return 0;
696696
}

0 commit comments

Comments
 (0)