aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-06-03 01:53:35 -0400
committerArtem Bityutskiy <dedekind1@gmail.com>2011-07-04 03:54:28 -0400
commit8d7819b4af697eec45339cc24db7c3fe45fea0e7 (patch)
tree2a32526fbf5a4cac8a3056352efcd6b69c4785b6 /fs/ubifs
parent2b1844a8c934723134ee1ff313e51d0d281cdef1 (diff)
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>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/commit.c2
-rw-r--r--fs/ubifs/debug.c4
-rw-r--r--fs/ubifs/debug.h24
-rw-r--r--fs/ubifs/lpt_commit.c1
-rw-r--r--fs/ubifs/tnc_commit.c6
5 files changed, 12 insertions, 25 deletions
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c
index 63c4e447f977..fb3b5c813a30 100644
--- a/fs/ubifs/commit.c
+++ b/fs/ubifs/commit.c
@@ -576,7 +576,7 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
576 struct idx_node *i; 576 struct idx_node *i;
577 size_t sz; 577 size_t sz;
578 578
579 if (!dbg_is_chk_old_idx(c)) 579 if (!dbg_is_chk_index(c))
580 return 0; 580 return 0;
581 581
582 INIT_LIST_HEAD(&list); 582 INIT_LIST_HEAD(&list);
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 79d8924aca5b..a967d6800ead 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -1544,7 +1544,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra)
1544 long clean_cnt = 0, dirty_cnt = 0; 1544 long clean_cnt = 0, dirty_cnt = 0;
1545 int err, last; 1545 int err, last;
1546 1546
1547 if (!dbg_is_chk_tnc(c)) 1547 if (!dbg_is_chk_index(c))
1548 return 0; 1548 return 0;
1549 1549
1550 ubifs_assert(mutex_is_locked(&c->tnc_mutex)); 1550 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 int err; 1791 int err;
1792 long long calc = 0; 1792 long long calc = 0;
1793 1793
1794 if (!dbg_is_chk_idx_sz(c)) 1794 if (!dbg_is_chk_index(c))
1795 return 0; 1795 return 0;
1796 1796
1797 err = dbg_walk_index(c, NULL, add_size, &calc); 1797 err = dbg_walk_index(c, NULL, add_size, &calc);
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index c3d1ffd0610a..44265a3a08ce 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -173,19 +173,15 @@ extern spinlock_t dbg_lock;
173 * Debugging check flags. 173 * Debugging check flags.
174 * 174 *
175 * UBIFS_CHK_GEN: general checks 175 * UBIFS_CHK_GEN: general checks
176 * UBIFS_CHK_TNC: check TNC 176 * UBIFS_CHK_INDEX: check the index
177 * UBIFS_CHK_IDX_SZ: check index size
178 * UBIFS_CHK_ORPH: check orphans 177 * UBIFS_CHK_ORPH: check orphans
179 * UBIFS_CHK_OLD_IDX: check the old index
180 * UBIFS_CHK_LPROPS: check lprops 178 * UBIFS_CHK_LPROPS: check lprops
181 * UBIFS_CHK_FS: check the file-system 179 * UBIFS_CHK_FS: check the file-system
182 */ 180 */
183enum { 181enum {
184 UBIFS_CHK_GEN = 0x1, 182 UBIFS_CHK_GEN = 0x1,
185 UBIFS_CHK_TNC = 0x2, 183 UBIFS_CHK_INDEX = 0x2,
186 UBIFS_CHK_IDX_SZ = 0x4,
187 UBIFS_CHK_ORPH = 0x8, 184 UBIFS_CHK_ORPH = 0x8,
188 UBIFS_CHK_OLD_IDX = 0x10,
189 UBIFS_CHK_LPROPS = 0x20, 185 UBIFS_CHK_LPROPS = 0x20,
190 UBIFS_CHK_FS = 0x40, 186 UBIFS_CHK_FS = 0x40,
191}; 187};
@@ -207,22 +203,14 @@ static inline int dbg_is_chk_gen(const struct ubifs_info *c)
207{ 203{
208 return !!(ubifs_chk_flags & UBIFS_CHK_GEN); 204 return !!(ubifs_chk_flags & UBIFS_CHK_GEN);
209} 205}
210static inline int dbg_is_chk_tnc(const struct ubifs_info *c) 206static 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}
214static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c)
215{
216 return !!(ubifs_chk_flags & UBIFS_CHK_IDX_SZ);
217} 209}
218static inline int dbg_is_chk_orph(const struct ubifs_info *c) 210static inline int dbg_is_chk_orph(const struct ubifs_info *c)
219{ 211{
220 return !!(ubifs_chk_flags & UBIFS_CHK_ORPH); 212 return !!(ubifs_chk_flags & UBIFS_CHK_ORPH);
221} 213}
222static inline int dbg_is_chk_old_idx(const struct ubifs_info *c)
223{
224 return !!(ubifs_chk_flags & UBIFS_CHK_OLD_IDX);
225}
226static inline int dbg_is_chk_lprops(const struct ubifs_info *c) 214static inline int dbg_is_chk_lprops(const struct ubifs_info *c)
227{ 215{
228 return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS); 216 return !!(ubifs_chk_flags & UBIFS_CHK_LPROPS);
@@ -462,10 +450,8 @@ dbg_check_nondata_nodes_order(struct ubifs_info *c,
462 struct list_head *head) { return 0; } 450 struct list_head *head) { return 0; }
463 451
464static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; } 452static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; }
465static inline int dbg_is_chk_tnc(const struct ubifs_info *c) { return 0; } 453static inline int dbg_is_chk_index(const struct ubifs_info *c) { return 0; }
466static inline int dbg_is_chk_idx_sz(const struct ubifs_info *c) { return 0; }
467static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; } 454static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; }
468static inline int dbg_is_chk_old_idx(const struct ubifs_info *c) { return 0; }
469static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; } 455static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; }
470static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; } 456static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; }
471static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; } 457static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; }
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index f8e286ba8095..f13addf72e89 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -27,6 +27,7 @@
27 27
28#include <linux/crc16.h> 28#include <linux/crc16.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/random.h>
30#include "ubifs.h" 31#include "ubifs.h"
31 32
32#ifdef CONFIG_UBIFS_FS_DEBUG 33#ifdef CONFIG_UBIFS_FS_DEBUG
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 8959c726b024..4c15f07a8bb2 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -22,8 +22,8 @@
22 22
23/* This file implements TNC functions for committing */ 23/* This file implements TNC functions for committing */
24 24
25#include "ubifs.h"
26#include <linux/random.h> 25#include <linux/random.h>
26#include "ubifs.h"
27 27
28/** 28/**
29 * make_idx_node - make an index node for fill-the-gaps method of TNC commit. 29 * 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 c->gap_lebs = NULL; 382 c->gap_lebs = NULL;
383 return err; 383 return err;
384 } 384 }
385 if (!dbg_is_chk_gen(c)) { 385 if (!dbg_is_chk_index(c)) {
386 /* 386 /*
387 * Do not print scary warnings if the debugging 387 * Do not print scary warnings if the debugging
388 * option which forces in-the-gaps is enabled. 388 * option which forces in-the-gaps is enabled.
@@ -690,7 +690,7 @@ static int alloc_idx_lebs(struct ubifs_info *c, int cnt)
690 c->ilebs[c->ileb_cnt++] = lnum; 690 c->ilebs[c->ileb_cnt++] = lnum;
691 dbg_cmt("LEB %d", lnum); 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 return -ENOSPC; 694 return -ENOSPC;
695 return 0; 695 return 0;
696} 696}