Commit 8d7819b4af697eec45339cc24db7c3fe45fea0e7

Authored by Artem Bityutskiy
Committed by Artem Bityutskiy
1 parent 2b1844a8c9

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>

Showing 6 changed files with 13 additions and 28 deletions Side-by-side Diff

Documentation/filesystems/ubifs.txt
... ... @@ -123,10 +123,8 @@
123 123 Check Flag value
124 124  
125 125 General checks 1
126   - Check Tree Node Cache (TNC) 2
127   - Check indexing tree size 4
  126 + Check the index 2
128 127 Check orphan area 8
129   - Check old indexing tree 16
130 128 Check LEB properties (lprops) 32
131 129 Check leaf nodes and inodes 64
132 130  
... ... @@ -576,7 +576,7 @@
576 576 struct idx_node *i;
577 577 size_t sz;
578 578  
579   - if (!dbg_is_chk_old_idx(c))
  579 + if (!dbg_is_chk_index(c))
580 580 return 0;
581 581  
582 582 INIT_LIST_HEAD(&list);
... ... @@ -1544,7 +1544,7 @@
1544 1544 long clean_cnt = 0, dirty_cnt = 0;
1545 1545 int err, last;
1546 1546  
1547   - if (!dbg_is_chk_tnc(c))
  1547 + if (!dbg_is_chk_index(c))
1548 1548 return 0;
1549 1549  
1550 1550 ubifs_assert(mutex_is_locked(&c->tnc_mutex));
... ... @@ -1791,7 +1791,7 @@
1791 1791 int err;
1792 1792 long long calc = 0;
1793 1793  
1794   - if (!dbg_is_chk_idx_sz(c))
  1794 + if (!dbg_is_chk_index(c))
1795 1795 return 0;
1796 1796  
1797 1797 err = dbg_walk_index(c, NULL, add_size, &calc);
... ... @@ -173,19 +173,15 @@
173 173 * Debugging check flags.
174 174 *
175 175 * 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
178 177 * UBIFS_CHK_ORPH: check orphans
179   - * UBIFS_CHK_OLD_IDX: check the old index
180 178 * UBIFS_CHK_LPROPS: check lprops
181 179 * UBIFS_CHK_FS: check the file-system
182 180 */
183 181 enum {
184 182 UBIFS_CHK_GEN = 0x1,
185   - UBIFS_CHK_TNC = 0x2,
186   - UBIFS_CHK_IDX_SZ = 0x4,
  183 + UBIFS_CHK_INDEX = 0x2,
187 184 UBIFS_CHK_ORPH = 0x8,
188   - UBIFS_CHK_OLD_IDX = 0x10,
189 185 UBIFS_CHK_LPROPS = 0x20,
190 186 UBIFS_CHK_FS = 0x40,
191 187 };
192 188  
193 189  
194 190  
... ... @@ -207,22 +203,14 @@
207 203 {
208 204 return !!(ubifs_chk_flags & UBIFS_CHK_GEN);
209 205 }
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)
211 207 {
212   - return !!(ubifs_chk_flags & UBIFS_CHK_TNC);
  208 + return !!(ubifs_chk_flags & UBIFS_CHK_INDEX);
213 209 }
214   -static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c)
215   -{
216   - return !!(ubifs_chk_flags & UBIFS_CHK_IDX_SZ);
217   -}
218 210 static inline int dbg_is_chk_orph(const struct ubifs_info *c)
219 211 {
220 212 return !!(ubifs_chk_flags & UBIFS_CHK_ORPH);
221 213 }
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   -}
226 214 static inline int dbg_is_chk_lprops(const struct ubifs_info *c)
227 215 {
228 216 return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS);
229 217  
... ... @@ -462,10 +450,8 @@
462 450 struct list_head *head) { return 0; }
463 451  
464 452 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; }
467 454 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; }
469 455 static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; }
470 456 static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; }
471 457 static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; }
fs/ubifs/lpt_commit.c
... ... @@ -27,6 +27,7 @@
27 27  
28 28 #include <linux/crc16.h>
29 29 #include <linux/slab.h>
  30 +#include <linux/random.h>
30 31 #include "ubifs.h"
31 32  
32 33 #ifdef CONFIG_UBIFS_FS_DEBUG
fs/ubifs/tnc_commit.c
... ... @@ -22,8 +22,8 @@
22 22  
23 23 /* This file implements TNC functions for committing */
24 24  
25   -#include "ubifs.h"
26 25 #include <linux/random.h>
  26 +#include "ubifs.h"
27 27  
28 28 /**
29 29 * make_idx_node - make an index node for fill-the-gaps method of TNC commit.
... ... @@ -382,7 +382,7 @@
382 382 c->gap_lebs = NULL;
383 383 return err;
384 384 }
385   - if (!dbg_is_chk_gen(c)) {
  385 + if (!dbg_is_chk_index(c)) {
386 386 /*
387 387 * Do not print scary warnings if the debugging
388 388 * option which forces in-the-gaps is enabled.
... ... @@ -690,7 +690,7 @@
690 690 c->ilebs[c->ileb_cnt++] = lnum;
691 691 dbg_cmt("LEB %d", lnum);
692 692 }
693   - if (dbg_is_chk_gen(c) && !(random32() & 7))
  693 + if (dbg_is_chk_index(c) && !(random32() & 7))
694 694 return -ENOSPC;
695 695 return 0;
696 696 }