diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-05-16 12:53:46 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-05-16 12:53:46 -0400 |
commit | f70b7e52aa23c9aea5346b9730b402fb55f9079b (patch) | |
tree | 20882b6e8345b8836d395248fd7f31fce7d09236 /fs | |
parent | 1baafd28dc17422f10be9b2a3a75432154e3abc7 (diff) |
UBIFS: remove Kconfig debugging option
Have the debugging stuff always compiled-in instead. It simplifies maintanance
a lot.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ubifs/Kconfig | 17 | ||||
-rw-r--r-- | fs/ubifs/Makefile | 4 | ||||
-rw-r--r-- | fs/ubifs/commit.c | 6 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 4 | ||||
-rw-r--r-- | fs/ubifs/debug.h | 153 | ||||
-rw-r--r-- | fs/ubifs/dir.c | 8 | ||||
-rw-r--r-- | fs/ubifs/log.c | 8 | ||||
-rw-r--r-- | fs/ubifs/lprops.c | 6 | ||||
-rw-r--r-- | fs/ubifs/lpt.c | 4 | ||||
-rw-r--r-- | fs/ubifs/lpt_commit.c | 10 | ||||
-rw-r--r-- | fs/ubifs/orphan.c | 10 | ||||
-rw-r--r-- | fs/ubifs/sb.c | 2 | ||||
-rw-r--r-- | fs/ubifs/tnc.c | 4 | ||||
-rw-r--r-- | fs/ubifs/tnc_commit.c | 10 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 11 |
15 files changed, 19 insertions, 238 deletions
diff --git a/fs/ubifs/Kconfig b/fs/ubifs/Kconfig index e49a23ca117a..ba66d508006a 100644 --- a/fs/ubifs/Kconfig +++ b/fs/ubifs/Kconfig | |||
@@ -35,20 +35,3 @@ config UBIFS_FS_ZLIB | |||
35 | default y | 35 | default y |
36 | help | 36 | help |
37 | Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. | 37 | Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. |
38 | |||
39 | # Debugging-related stuff | ||
40 | config UBIFS_FS_DEBUG | ||
41 | bool "Enable debugging support" | ||
42 | depends on UBIFS_FS | ||
43 | select DEBUG_FS | ||
44 | select KALLSYMS | ||
45 | help | ||
46 | This option enables UBIFS debugging support. It makes sure various | ||
47 | assertions, self-checks, debugging messages and test modes are compiled | ||
48 | in (this all is compiled out otherwise). Assertions are light-weight | ||
49 | and this option also enables them. Self-checks, debugging messages and | ||
50 | test modes are switched off by default. Thus, it is safe and actually | ||
51 | recommended to have debugging support enabled, and it should not slow | ||
52 | down UBIFS. You can then further enable / disable individual debugging | ||
53 | features using UBIFS module parameters and the corresponding sysfs | ||
54 | interfaces. | ||
diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile index 4878614d06f9..2c6f0cb816b4 100644 --- a/fs/ubifs/Makefile +++ b/fs/ubifs/Makefile | |||
@@ -3,6 +3,4 @@ obj-$(CONFIG_UBIFS_FS) += ubifs.o | |||
3 | ubifs-y += shrinker.o journal.o file.o dir.o super.o sb.o io.o | 3 | ubifs-y += shrinker.o journal.o file.o dir.o super.o sb.o io.o |
4 | ubifs-y += tnc.o master.o scan.o replay.o log.o commit.o gc.o orphan.o | 4 | ubifs-y += tnc.o master.o scan.o replay.o log.o commit.o gc.o orphan.o |
5 | ubifs-y += budget.o find.o tnc_commit.o compress.o lpt.o lprops.o | 5 | ubifs-y += budget.o find.o tnc_commit.o compress.o lpt.o lprops.o |
6 | ubifs-y += recovery.o ioctl.o lpt_commit.o tnc_misc.o xattr.o | 6 | ubifs-y += recovery.o ioctl.o lpt_commit.o tnc_misc.o xattr.o debug.o |
7 | |||
8 | ubifs-$(CONFIG_UBIFS_FS_DEBUG) += debug.o | ||
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c index 4f795d1c4866..5da20c193634 100644 --- a/fs/ubifs/commit.c +++ b/fs/ubifs/commit.c | |||
@@ -496,7 +496,9 @@ int ubifs_gc_should_commit(struct ubifs_info *c) | |||
496 | return ret; | 496 | return ret; |
497 | } | 497 | } |
498 | 498 | ||
499 | #ifdef CONFIG_UBIFS_FS_DEBUG | 499 | /* |
500 | * Everything below is related to debugging. | ||
501 | */ | ||
500 | 502 | ||
501 | /** | 503 | /** |
502 | * struct idx_node - hold index nodes during index tree traversal. | 504 | * struct idx_node - hold index nodes during index tree traversal. |
@@ -734,5 +736,3 @@ out_free: | |||
734 | err = -EINVAL; | 736 | err = -EINVAL; |
735 | return err; | 737 | return err; |
736 | } | 738 | } |
737 | |||
738 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 914b4c879938..3eef25343393 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -34,8 +34,6 @@ | |||
34 | #include <linux/random.h> | 34 | #include <linux/random.h> |
35 | #include "ubifs.h" | 35 | #include "ubifs.h" |
36 | 36 | ||
37 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
38 | |||
39 | static DEFINE_SPINLOCK(dbg_lock); | 37 | static DEFINE_SPINLOCK(dbg_lock); |
40 | 38 | ||
41 | static const char *get_key_fmt(int fmt) | 39 | static const char *get_key_fmt(int fmt) |
@@ -3189,5 +3187,3 @@ void ubifs_debugging_exit(struct ubifs_info *c) | |||
3189 | { | 3187 | { |
3190 | kfree(c->dbg); | 3188 | kfree(c->dbg); |
3191 | } | 3189 | } |
3192 | |||
3193 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index b34aeff07523..7a6a9e279df1 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -29,8 +29,6 @@ typedef int (*dbg_leaf_callback)(struct ubifs_info *c, | |||
29 | typedef int (*dbg_znode_callback)(struct ubifs_info *c, | 29 | typedef int (*dbg_znode_callback)(struct ubifs_info *c, |
30 | struct ubifs_znode *znode, void *priv); | 30 | struct ubifs_znode *znode, void *priv); |
31 | 31 | ||
32 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
33 | |||
34 | /* | 32 | /* |
35 | * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" | 33 | * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" |
36 | * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. | 34 | * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. |
@@ -317,155 +315,4 @@ void dbg_debugfs_exit(void); | |||
317 | int dbg_debugfs_init_fs(struct ubifs_info *c); | 315 | int dbg_debugfs_init_fs(struct ubifs_info *c); |
318 | void dbg_debugfs_exit_fs(struct ubifs_info *c); | 316 | void dbg_debugfs_exit_fs(struct ubifs_info *c); |
319 | 317 | ||
320 | #else /* !CONFIG_UBIFS_FS_DEBUG */ | ||
321 | |||
322 | /* Use "if (0)" to make compiler check arguments even if debugging is off */ | ||
323 | #define ubifs_assert(expr) do { \ | ||
324 | if (0) \ | ||
325 | printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ | ||
326 | __func__, __LINE__, current->pid); \ | ||
327 | } while (0) | ||
328 | |||
329 | #define dbg_err(fmt, ...) do { \ | ||
330 | if (0) \ | ||
331 | ubifs_err(fmt, ##__VA_ARGS__); \ | ||
332 | } while (0) | ||
333 | |||
334 | #define ubifs_dbg_msg(fmt, ...) do { \ | ||
335 | if (0) \ | ||
336 | printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \ | ||
337 | } while (0) | ||
338 | |||
339 | #define ubifs_assert_cmt_locked(c) | ||
340 | |||
341 | #define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
342 | #define dbg_gen(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
343 | #define dbg_jnl(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
344 | #define dbg_jnlk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
345 | #define dbg_tnc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
346 | #define dbg_tnck(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
347 | #define dbg_lp(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
348 | #define dbg_find(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
349 | #define dbg_mnt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
350 | #define dbg_mntk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
351 | #define dbg_io(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
352 | #define dbg_cmt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
353 | #define dbg_budg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
354 | #define dbg_log(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
355 | #define dbg_gc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
356 | #define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
357 | #define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
358 | |||
359 | static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; } | ||
360 | static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; } | ||
361 | static inline const char *dbg_ntype(int type) { return ""; } | ||
362 | static inline const char *dbg_cstate(int cmt_state) { return ""; } | ||
363 | static inline const char *dbg_jhead(int jhead) { return ""; } | ||
364 | static inline const char * | ||
365 | dbg_get_key_dump(const struct ubifs_info *c, | ||
366 | const union ubifs_key *key) { return ""; } | ||
367 | static inline const char * | ||
368 | dbg_snprintf_key(const struct ubifs_info *c, | ||
369 | const union ubifs_key *key, char *buffer, | ||
370 | int len) { return ""; } | ||
371 | static inline void ubifs_dump_inode(struct ubifs_info *c, | ||
372 | const struct inode *inode) { return; } | ||
373 | static inline void ubifs_dump_node(const struct ubifs_info *c, | ||
374 | const void *node) { return; } | ||
375 | static inline void | ||
376 | ubifs_dump_budget_req(const struct ubifs_budget_req *req) { return; } | ||
377 | static inline void | ||
378 | ubifs_dump_lstats(const struct ubifs_lp_stats *lst) { return; } | ||
379 | static inline void | ||
380 | ubifs_dump_budg(struct ubifs_info *c, | ||
381 | const struct ubifs_budg_info *bi) { return; } | ||
382 | static inline void ubifs_dump_lprop(const struct ubifs_info *c, | ||
383 | const struct ubifs_lprops *lp){ return; } | ||
384 | static inline void ubifs_dump_lprops(struct ubifs_info *c) { return; } | ||
385 | static inline void ubifs_dump_lpt_info(struct ubifs_info *c) { return; } | ||
386 | static inline void ubifs_dump_leb(const struct ubifs_info *c, | ||
387 | int lnum) { return; } | ||
388 | static inline void | ||
389 | ubifs_dump_sleb(const struct ubifs_info *c, | ||
390 | const struct ubifs_scan_leb *sleb, int offs) { return; } | ||
391 | static inline void | ||
392 | ubifs_dump_znode(const struct ubifs_info *c, | ||
393 | const struct ubifs_znode *znode) { return; } | ||
394 | static inline void ubifs_dump_heap(struct ubifs_info *c, | ||
395 | struct ubifs_lpt_heap *heap, | ||
396 | int cat) { return; } | ||
397 | static inline void ubifs_dump_pnode(struct ubifs_info *c, | ||
398 | struct ubifs_pnode *pnode, | ||
399 | struct ubifs_nnode *parent, | ||
400 | int iip) { return; } | ||
401 | static inline void ubifs_dump_tnc(struct ubifs_info *c) { return; } | ||
402 | static inline void ubifs_dump_index(struct ubifs_info *c) { return; } | ||
403 | static inline void ubifs_dump_lpt_lebs(const struct ubifs_info *c){ return; } | ||
404 | |||
405 | static inline int dbg_walk_index(struct ubifs_info *c, | ||
406 | dbg_leaf_callback leaf_cb, | ||
407 | dbg_znode_callback znode_cb, | ||
408 | void *priv) { return 0; } | ||
409 | static inline void dbg_save_space_info(struct ubifs_info *c) { return; } | ||
410 | static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; } | ||
411 | static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; } | ||
412 | static inline int | ||
413 | dbg_old_index_check_init(struct ubifs_info *c, | ||
414 | struct ubifs_zbranch *zroot) { return 0; } | ||
415 | static inline int | ||
416 | dbg_check_old_index(struct ubifs_info *c, | ||
417 | struct ubifs_zbranch *zroot) { return 0; } | ||
418 | static inline int dbg_check_cats(struct ubifs_info *c) { return 0; } | ||
419 | static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; } | ||
420 | static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; } | ||
421 | static inline int dbg_chk_lpt_sz(struct ubifs_info *c, | ||
422 | int action, int len) { return 0; } | ||
423 | static inline int | ||
424 | dbg_check_synced_i_size(const struct ubifs_info *c, | ||
425 | struct inode *inode) { return 0; } | ||
426 | static inline int dbg_check_dir(struct ubifs_info *c, | ||
427 | const struct inode *dir) { return 0; } | ||
428 | static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; } | ||
429 | static inline int dbg_check_idx_size(struct ubifs_info *c, | ||
430 | long long idx_size) { return 0; } | ||
431 | static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; } | ||
432 | static inline void dbg_check_heap(struct ubifs_info *c, | ||
433 | struct ubifs_lpt_heap *heap, | ||
434 | int cat, int add_pos) { return; } | ||
435 | static inline int dbg_check_lpt_nodes(struct ubifs_info *c, | ||
436 | struct ubifs_cnode *cnode, int row, int col) { return 0; } | ||
437 | static inline int dbg_check_inode_size(struct ubifs_info *c, | ||
438 | const struct inode *inode, | ||
439 | loff_t size) { return 0; } | ||
440 | static inline int | ||
441 | dbg_check_data_nodes_order(struct ubifs_info *c, | ||
442 | struct list_head *head) { return 0; } | ||
443 | static inline int | ||
444 | dbg_check_nondata_nodes_order(struct ubifs_info *c, | ||
445 | struct list_head *head) { return 0; } | ||
446 | |||
447 | static inline int dbg_leb_write(struct ubifs_info *c, int lnum, | ||
448 | const void *buf, int offset, | ||
449 | int len, int dtype) { return 0; } | ||
450 | static inline int dbg_leb_change(struct ubifs_info *c, int lnum, | ||
451 | const void *buf, int len, | ||
452 | int dtype) { return 0; } | ||
453 | static inline int dbg_leb_unmap(struct ubifs_info *c, int lnum) { return 0; } | ||
454 | static inline int dbg_leb_map(struct ubifs_info *c, int lnum, | ||
455 | int dtype) { return 0; } | ||
456 | |||
457 | static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; } | ||
458 | static inline int dbg_is_chk_index(const struct ubifs_info *c) { return 0; } | ||
459 | static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; } | ||
460 | static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; } | ||
461 | static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; } | ||
462 | static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; } | ||
463 | static inline int dbg_is_power_cut(const struct ubifs_info *c) { return 0; } | ||
464 | |||
465 | static inline int dbg_debugfs_init(void) { return 0; } | ||
466 | static inline void dbg_debugfs_exit(void) { return; } | ||
467 | static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; } | ||
468 | static inline int dbg_debugfs_exit_fs(struct ubifs_info *c) { return 0; } | ||
469 | |||
470 | #endif /* !CONFIG_UBIFS_FS_DEBUG */ | ||
471 | #endif /* !__UBIFS_DEBUG_H__ */ | 318 | #endif /* !__UBIFS_DEBUG_H__ */ |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index ad6e550acdc0..62a2727f4ecf 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -170,8 +170,6 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, | |||
170 | return inode; | 170 | return inode; |
171 | } | 171 | } |
172 | 172 | ||
173 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
174 | |||
175 | static int dbg_check_name(const struct ubifs_info *c, | 173 | static int dbg_check_name(const struct ubifs_info *c, |
176 | const struct ubifs_dent_node *dent, | 174 | const struct ubifs_dent_node *dent, |
177 | const struct qstr *nm) | 175 | const struct qstr *nm) |
@@ -185,12 +183,6 @@ static int dbg_check_name(const struct ubifs_info *c, | |||
185 | return 0; | 183 | return 0; |
186 | } | 184 | } |
187 | 185 | ||
188 | #else | ||
189 | |||
190 | #define dbg_check_name(c, dent, nm) 0 | ||
191 | |||
192 | #endif | ||
193 | |||
194 | static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, | 186 | static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, |
195 | struct nameidata *nd) | 187 | struct nameidata *nd) |
196 | { | 188 | { |
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index f9fd068d1ae0..9967b5a21f41 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -29,11 +29,7 @@ | |||
29 | 29 | ||
30 | #include "ubifs.h" | 30 | #include "ubifs.h" |
31 | 31 | ||
32 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
33 | static int dbg_check_bud_bytes(struct ubifs_info *c); | 32 | static int dbg_check_bud_bytes(struct ubifs_info *c); |
34 | #else | ||
35 | #define dbg_check_bud_bytes(c) 0 | ||
36 | #endif | ||
37 | 33 | ||
38 | /** | 34 | /** |
39 | * ubifs_search_bud - search bud LEB. | 35 | * ubifs_search_bud - search bud LEB. |
@@ -734,8 +730,6 @@ out_free: | |||
734 | return err; | 730 | return err; |
735 | } | 731 | } |
736 | 732 | ||
737 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
738 | |||
739 | /** | 733 | /** |
740 | * dbg_check_bud_bytes - make sure bud bytes calculation are all right. | 734 | * dbg_check_bud_bytes - make sure bud bytes calculation are all right. |
741 | * @c: UBIFS file-system description object | 735 | * @c: UBIFS file-system description object |
@@ -767,5 +761,3 @@ static int dbg_check_bud_bytes(struct ubifs_info *c) | |||
767 | 761 | ||
768 | return err; | 762 | return err; |
769 | } | 763 | } |
770 | |||
771 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index 0cf7a18e174c..86eb8e533249 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c | |||
@@ -846,7 +846,9 @@ const struct ubifs_lprops *ubifs_fast_find_frdi_idx(struct ubifs_info *c) | |||
846 | return lprops; | 846 | return lprops; |
847 | } | 847 | } |
848 | 848 | ||
849 | #ifdef CONFIG_UBIFS_FS_DEBUG | 849 | /* |
850 | * Everything below is related to debugging. | ||
851 | */ | ||
850 | 852 | ||
851 | /** | 853 | /** |
852 | * dbg_check_cats - check category heaps and lists. | 854 | * dbg_check_cats - check category heaps and lists. |
@@ -1315,5 +1317,3 @@ int dbg_check_lprops(struct ubifs_info *c) | |||
1315 | out: | 1317 | out: |
1316 | return err; | 1318 | return err; |
1317 | } | 1319 | } |
1318 | |||
1319 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index b6db389654b0..5d1d97d00966 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -2080,8 +2080,6 @@ out: | |||
2080 | return err; | 2080 | return err; |
2081 | } | 2081 | } |
2082 | 2082 | ||
2083 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
2084 | |||
2085 | /** | 2083 | /** |
2086 | * dbg_chk_pnode - check a pnode. | 2084 | * dbg_chk_pnode - check a pnode. |
2087 | * @c: the UBIFS file-system description object | 2085 | * @c: the UBIFS file-system description object |
@@ -2274,5 +2272,3 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, | |||
2274 | } | 2272 | } |
2275 | return 0; | 2273 | return 0; |
2276 | } | 2274 | } |
2277 | |||
2278 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 8294d5af87b3..97822db3afbc 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -30,11 +30,7 @@ | |||
30 | #include <linux/random.h> | 30 | #include <linux/random.h> |
31 | #include "ubifs.h" | 31 | #include "ubifs.h" |
32 | 32 | ||
33 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
34 | static int dbg_populate_lsave(struct ubifs_info *c); | 33 | static int dbg_populate_lsave(struct ubifs_info *c); |
35 | #else | ||
36 | #define dbg_populate_lsave(c) 0 | ||
37 | #endif | ||
38 | 34 | ||
39 | /** | 35 | /** |
40 | * first_dirty_cnode - find first dirty cnode. | 36 | * first_dirty_cnode - find first dirty cnode. |
@@ -1497,7 +1493,9 @@ void ubifs_lpt_free(struct ubifs_info *c, int wr_only) | |||
1497 | kfree(c->lpt_nod_buf); | 1493 | kfree(c->lpt_nod_buf); |
1498 | } | 1494 | } |
1499 | 1495 | ||
1500 | #ifdef CONFIG_UBIFS_FS_DEBUG | 1496 | /* |
1497 | * Everything below is related to debugging. | ||
1498 | */ | ||
1501 | 1499 | ||
1502 | /** | 1500 | /** |
1503 | * dbg_is_all_ff - determine if a buffer contains only 0xFF bytes. | 1501 | * dbg_is_all_ff - determine if a buffer contains only 0xFF bytes. |
@@ -2046,5 +2044,3 @@ static int dbg_populate_lsave(struct ubifs_info *c) | |||
2046 | 2044 | ||
2047 | return 1; | 2045 | return 1; |
2048 | } | 2046 | } |
2049 | |||
2050 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index 48ac7212e78b..97ad042e4715 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -52,11 +52,7 @@ | |||
52 | * than the maximum number of orphans allowed. | 52 | * than the maximum number of orphans allowed. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
56 | static int dbg_check_orphans(struct ubifs_info *c); | 55 | static int dbg_check_orphans(struct ubifs_info *c); |
57 | #else | ||
58 | #define dbg_check_orphans(c) 0 | ||
59 | #endif | ||
60 | 56 | ||
61 | /** | 57 | /** |
62 | * ubifs_add_orphan - add an orphan. | 58 | * ubifs_add_orphan - add an orphan. |
@@ -725,7 +721,9 @@ int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only) | |||
725 | return err; | 721 | return err; |
726 | } | 722 | } |
727 | 723 | ||
728 | #ifdef CONFIG_UBIFS_FS_DEBUG | 724 | /* |
725 | * Everything below is related to debugging. | ||
726 | */ | ||
729 | 727 | ||
730 | struct check_orphan { | 728 | struct check_orphan { |
731 | struct rb_node rb; | 729 | struct rb_node rb; |
@@ -968,5 +966,3 @@ out: | |||
968 | kfree(ci.node); | 966 | kfree(ci.node); |
969 | return err; | 967 | return err; |
970 | } | 968 | } |
971 | |||
972 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index c51f6a4af0f1..a880d0c152e5 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -130,7 +130,6 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
130 | * orphan node. | 130 | * orphan node. |
131 | */ | 131 | */ |
132 | orph_lebs = UBIFS_MIN_ORPH_LEBS; | 132 | orph_lebs = UBIFS_MIN_ORPH_LEBS; |
133 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
134 | if (c->leb_cnt - min_leb_cnt > 1) | 133 | if (c->leb_cnt - min_leb_cnt > 1) |
135 | /* | 134 | /* |
136 | * For debugging purposes it is better to have at least 2 | 135 | * For debugging purposes it is better to have at least 2 |
@@ -138,7 +137,6 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
138 | * consolidations and would be stressed more. | 137 | * consolidations and would be stressed more. |
139 | */ | 138 | */ |
140 | orph_lebs += 1; | 139 | orph_lebs += 1; |
141 | #endif | ||
142 | 140 | ||
143 | main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - log_lebs; | 141 | main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - log_lebs; |
144 | main_lebs -= orph_lebs; | 142 | main_lebs -= orph_lebs; |
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 12c25d925d3f..a50b6bd2f4ce 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -3275,8 +3275,6 @@ out_unlock: | |||
3275 | return err; | 3275 | return err; |
3276 | } | 3276 | } |
3277 | 3277 | ||
3278 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
3279 | |||
3280 | /** | 3278 | /** |
3281 | * dbg_check_inode_size - check if inode size is correct. | 3279 | * dbg_check_inode_size - check if inode size is correct. |
3282 | * @c: UBIFS file-system description object | 3280 | * @c: UBIFS file-system description object |
@@ -3343,5 +3341,3 @@ out_unlock: | |||
3343 | mutex_unlock(&c->tnc_mutex); | 3341 | mutex_unlock(&c->tnc_mutex); |
3344 | return err; | 3342 | return err; |
3345 | } | 3343 | } |
3346 | |||
3347 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index e8cf891185ec..ef5df1e24dca 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -61,11 +61,9 @@ static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, | |||
61 | } | 61 | } |
62 | ubifs_prepare_node(c, idx, len, 0); | 62 | ubifs_prepare_node(c, idx, len, 0); |
63 | 63 | ||
64 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
65 | znode->lnum = lnum; | 64 | znode->lnum = lnum; |
66 | znode->offs = offs; | 65 | znode->offs = offs; |
67 | znode->len = len; | 66 | znode->len = len; |
68 | #endif | ||
69 | 67 | ||
70 | err = insert_old_idx_znode(c, znode); | 68 | err = insert_old_idx_znode(c, znode); |
71 | 69 | ||
@@ -456,11 +454,9 @@ static int layout_in_empty_space(struct ubifs_info *c) | |||
456 | 454 | ||
457 | offs = buf_offs + used; | 455 | offs = buf_offs + used; |
458 | 456 | ||
459 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
460 | znode->lnum = lnum; | 457 | znode->lnum = lnum; |
461 | znode->offs = offs; | 458 | znode->offs = offs; |
462 | znode->len = len; | 459 | znode->len = len; |
463 | #endif | ||
464 | 460 | ||
465 | /* Update the parent */ | 461 | /* Update the parent */ |
466 | zp = znode->parent; | 462 | zp = znode->parent; |
@@ -536,10 +532,8 @@ static int layout_in_empty_space(struct ubifs_info *c) | |||
536 | break; | 532 | break; |
537 | } | 533 | } |
538 | 534 | ||
539 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
540 | c->dbg->new_ihead_lnum = lnum; | 535 | c->dbg->new_ihead_lnum = lnum; |
541 | c->dbg->new_ihead_offs = buf_offs; | 536 | c->dbg->new_ihead_offs = buf_offs; |
542 | #endif | ||
543 | 537 | ||
544 | return 0; | 538 | return 0; |
545 | } | 539 | } |
@@ -881,13 +875,11 @@ static int write_index(struct ubifs_info *c) | |||
881 | } | 875 | } |
882 | offs = buf_offs + used; | 876 | offs = buf_offs + used; |
883 | 877 | ||
884 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
885 | if (lnum != znode->lnum || offs != znode->offs || | 878 | if (lnum != znode->lnum || offs != znode->offs || |
886 | len != znode->len) { | 879 | len != znode->len) { |
887 | ubifs_err("inconsistent znode posn"); | 880 | ubifs_err("inconsistent znode posn"); |
888 | return -EINVAL; | 881 | return -EINVAL; |
889 | } | 882 | } |
890 | #endif | ||
891 | 883 | ||
892 | /* Grab some stuff from znode while we still can */ | 884 | /* Grab some stuff from znode while we still can */ |
893 | cnext = znode->cnext; | 885 | cnext = znode->cnext; |
@@ -982,13 +974,11 @@ static int write_index(struct ubifs_info *c) | |||
982 | break; | 974 | break; |
983 | } | 975 | } |
984 | 976 | ||
985 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
986 | if (lnum != c->dbg->new_ihead_lnum || | 977 | if (lnum != c->dbg->new_ihead_lnum || |
987 | buf_offs != c->dbg->new_ihead_offs) { | 978 | buf_offs != c->dbg->new_ihead_offs) { |
988 | ubifs_err("inconsistent ihead"); | 979 | ubifs_err("inconsistent ihead"); |
989 | return -EINVAL; | 980 | return -EINVAL; |
990 | } | 981 | } |
991 | #endif | ||
992 | 982 | ||
993 | c->ihead_lnum = lnum; | 983 | c->ihead_lnum = lnum; |
994 | c->ihead_offs = buf_offs; | 984 | c->ihead_offs = buf_offs; |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 93d59aceaaef..c2cf509e14db 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -762,6 +762,9 @@ struct ubifs_zbranch { | |||
762 | * @offs: offset of the corresponding indexing node | 762 | * @offs: offset of the corresponding indexing node |
763 | * @len: length of the corresponding indexing node | 763 | * @len: length of the corresponding indexing node |
764 | * @zbranch: array of znode branches (@c->fanout elements) | 764 | * @zbranch: array of znode branches (@c->fanout elements) |
765 | * | ||
766 | * Note! The @lnum, @offs, and @len fields are not really needed - we have them | ||
767 | * only for internal consistency check. They could be removed to save some RAM. | ||
765 | */ | 768 | */ |
766 | struct ubifs_znode { | 769 | struct ubifs_znode { |
767 | struct ubifs_znode *parent; | 770 | struct ubifs_znode *parent; |
@@ -772,9 +775,9 @@ struct ubifs_znode { | |||
772 | int child_cnt; | 775 | int child_cnt; |
773 | int iip; | 776 | int iip; |
774 | int alt; | 777 | int alt; |
775 | #ifdef CONFIG_UBIFS_FS_DEBUG | 778 | int lnum; |
776 | int lnum, offs, len; | 779 | int offs; |
777 | #endif | 780 | int len; |
778 | struct ubifs_zbranch zbranch[]; | 781 | struct ubifs_zbranch zbranch[]; |
779 | }; | 782 | }; |
780 | 783 | ||
@@ -1444,9 +1447,7 @@ struct ubifs_info { | |||
1444 | struct rb_root size_tree; | 1447 | struct rb_root size_tree; |
1445 | struct ubifs_mount_opts mount_opts; | 1448 | struct ubifs_mount_opts mount_opts; |
1446 | 1449 | ||
1447 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
1448 | struct ubifs_debug_info *dbg; | 1450 | struct ubifs_debug_info *dbg; |
1449 | #endif | ||
1450 | }; | 1451 | }; |
1451 | 1452 | ||
1452 | extern struct list_head ubifs_infos; | 1453 | extern struct list_head ubifs_infos; |