diff options
author | Artem B. Bityutskiy <dedekind@infradead.org> | 2005-08-05 07:43:47 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 13:14:35 -0500 |
commit | 45ca1b509ea156e87c99e529821fb3b548e14fe3 (patch) | |
tree | cd04eb424ea8205f2f2d9e92bf5abfc7431250fc /fs/jffs2 | |
parent | 3c09133739beff0d5ad457dfcfc85c7c350d3661 (diff) |
[JFFS2] Debug code clean up - step 7
Remove more noisy debugs. Add current->pid to debug messages.
Remove bogus includes.
Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/debug.c | 40 | ||||
-rw-r--r-- | fs/jffs2/debug.h | 82 | ||||
-rw-r--r-- | fs/jffs2/nodelist.c | 9 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 4 |
4 files changed, 71 insertions, 64 deletions
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c index 80ac9b6514bf..9b776b5a7604 100644 --- a/fs/jffs2/debug.c +++ b/fs/jffs2/debug.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: debug.c,v 1.8 2005/07/30 15:27:05 lunn Exp $ | 10 | * $Id: debug.c,v 1.9 2005/08/05 10:42:24 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
@@ -18,6 +18,44 @@ | |||
18 | #include "nodelist.h" | 18 | #include "nodelist.h" |
19 | #include "debug.h" | 19 | #include "debug.h" |
20 | 20 | ||
21 | #ifdef JFFS2_DBG_SANITY_CHECKS | ||
22 | |||
23 | void | ||
24 | __jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c, | ||
25 | struct jffs2_eraseblock *jeb) | ||
26 | { | ||
27 | if (unlikely(jeb && jeb->used_size + jeb->dirty_size + | ||
28 | jeb->free_size + jeb->wasted_size + | ||
29 | jeb->unchecked_size != c->sector_size)) { | ||
30 | JFFS2_ERROR("eeep, space accounting for block at 0x%08x is screwed.\n", jeb->offset); | ||
31 | JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + wasted %#08x + unchecked " | ||
32 | "%#08x != total %#08x.\n", jeb->free_size, jeb->dirty_size, jeb->used_size, | ||
33 | jeb->wasted_size, jeb->unchecked_size, c->sector_size); | ||
34 | BUG(); | ||
35 | } | ||
36 | |||
37 | if (unlikely(c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size | ||
38 | + c->wasted_size + c->unchecked_size != c->flash_size)) { | ||
39 | JFFS2_ERROR("eeep, space accounting superblock info is screwed.\n"); | ||
40 | JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + " | ||
41 | "wasted %#08x + unchecked %#08x != total %#08x.\n", | ||
42 | c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size, | ||
43 | c->wasted_size, c->unchecked_size, c->flash_size); | ||
44 | BUG(); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | void | ||
49 | __jffs2_dbg_acct_sanity_check(struct jffs2_sb_info *c, | ||
50 | struct jffs2_eraseblock *jeb) | ||
51 | { | ||
52 | spin_lock(&c->erase_completion_lock); | ||
53 | jffs2_dbg_acct_sanity_check_nolock(c, jeb); | ||
54 | spin_unlock(&c->erase_completion_lock); | ||
55 | } | ||
56 | |||
57 | #endif /* JFFS2_DBG_SANITY_CHECKS */ | ||
58 | |||
21 | #ifdef JFFS2_DBG_PARANOIA_CHECKS | 59 | #ifdef JFFS2_DBG_PARANOIA_CHECKS |
22 | /* | 60 | /* |
23 | * Check the fragtree. | 61 | * Check the fragtree. |
diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h index 11ee75922a5e..3a7b11c2dd86 100644 --- a/fs/jffs2/debug.h +++ b/fs/jffs2/debug.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: debug.h,v 1.10 2005/08/02 10:03:51 dedekind Exp $ | 10 | * $Id: debug.h,v 1.12 2005/08/05 10:43:47 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | #ifndef _JFFS2_DEBUG_H_ | 13 | #ifndef _JFFS2_DEBUG_H_ |
@@ -34,7 +34,7 @@ | |||
34 | #define JFFS2_DBG_FRAGTREE2_MESSAGES | 34 | #define JFFS2_DBG_FRAGTREE2_MESSAGES |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | /* Enable JFFS2 sanity checks by default */ | 37 | /* Sanity checks are supposed to be light-weight and enabled by default */ |
38 | #define JFFS2_DBG_SANITY_CHECKS | 38 | #define JFFS2_DBG_SANITY_CHECKS |
39 | 39 | ||
40 | /* | 40 | /* |
@@ -55,9 +55,9 @@ | |||
55 | 55 | ||
56 | /* The prefixes of JFFS2 messages */ | 56 | /* The prefixes of JFFS2 messages */ |
57 | #define JFFS2_DBG_MSG_PREFIX "[JFFS2 DBG]" | 57 | #define JFFS2_DBG_MSG_PREFIX "[JFFS2 DBG]" |
58 | #define JFFS2_ERR_MSG_PREFIX "JFFS2 error: " | 58 | #define JFFS2_ERR_MSG_PREFIX "JFFS2 error:" |
59 | #define JFFS2_WARN_MSG_PREFIX "JFFS2 warning: " | 59 | #define JFFS2_WARN_MSG_PREFIX "JFFS2 warning:" |
60 | #define JFFS2_NOTICE_MSG_PREFIX "JFFS2 notice: " | 60 | #define JFFS2_NOTICE_MSG_PREFIX "JFFS2 notice:" |
61 | 61 | ||
62 | #define JFFS2_ERR_LVL KERN_ERR | 62 | #define JFFS2_ERR_LVL KERN_ERR |
63 | #define JFFS2_WARN_LVL KERN_WARNING | 63 | #define JFFS2_WARN_LVL KERN_WARNING |
@@ -67,26 +67,30 @@ | |||
67 | /* JFFS2 message macros */ | 67 | /* JFFS2 message macros */ |
68 | #define JFFS2_ERROR(fmt, ...) \ | 68 | #define JFFS2_ERROR(fmt, ...) \ |
69 | do { \ | 69 | do { \ |
70 | printk(JFFS2_ERR_LVL JFFS2_ERR_MSG_PREFIX " %s: " \ | 70 | printk(JFFS2_ERR_LVL JFFS2_ERR_MSG_PREFIX \ |
71 | fmt, __FUNCTION__, ##__VA_ARGS__); \ | 71 | " %d,%s: " fmt, current->pid, \ |
72 | __FUNCTION__, ##__VA_ARGS__); \ | ||
72 | } while(0) | 73 | } while(0) |
73 | 74 | ||
74 | #define JFFS2_WARNING(fmt, ...) \ | 75 | #define JFFS2_WARNING(fmt, ...) \ |
75 | do { \ | 76 | do { \ |
76 | printk(JFFS2_WARN_LVL JFFS2_WARN_MSG_PREFIX " %s: " \ | 77 | printk(JFFS2_WARN_LVL JFFS2_WARN_MSG_PREFIX \ |
77 | fmt, __FUNCTION__, ##__VA_ARGS__); \ | 78 | " %d,%s: " fmt, current->pid, \ |
79 | __FUNCTION__, ##__VA_ARGS__); \ | ||
78 | } while(0) | 80 | } while(0) |
79 | 81 | ||
80 | #define JFFS2_NOTICE(fmt, ...) \ | 82 | #define JFFS2_NOTICE(fmt, ...) \ |
81 | do { \ | 83 | do { \ |
82 | printk(JFFS2_NOTICE_LVL JFFS2_NOTICE_MSG_PREFIX " %s: " \ | 84 | printk(JFFS2_NOTICE_LVL JFFS2_NOTICE_MSG_PREFIX \ |
83 | fmt, __FUNCTION__, ##__VA_ARGS__); \ | 85 | " %d,%s: " fmt, current->pid, \ |
86 | __FUNCTION__, ##__VA_ARGS__); \ | ||
84 | } while(0) | 87 | } while(0) |
85 | 88 | ||
86 | #define JFFS2_DEBUG(fmt, ...) \ | 89 | #define JFFS2_DEBUG(fmt, ...) \ |
87 | do { \ | 90 | do { \ |
88 | printk(JFFS2_DBG_LVL JFFS2_DBG_MSG_PREFIX " %s: " \ | 91 | printk(JFFS2_DBG_LVL JFFS2_DBG_MSG_PREFIX \ |
89 | fmt, __FUNCTION__, ##__VA_ARGS__); \ | 92 | " %d,%s: " fmt, current->pid, \ |
93 | __FUNCTION__, ##__VA_ARGS__); \ | ||
90 | } while(0) | 94 | } while(0) |
91 | 95 | ||
92 | /* | 96 | /* |
@@ -141,6 +145,14 @@ | |||
141 | #endif | 145 | #endif |
142 | 146 | ||
143 | 147 | ||
148 | /* "Sanity" checks */ | ||
149 | void | ||
150 | __jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c, | ||
151 | struct jffs2_eraseblock *jeb); | ||
152 | void | ||
153 | __jffs2_dbg_acct_sanity_check(struct jffs2_sb_info *c, | ||
154 | struct jffs2_eraseblock *jeb); | ||
155 | |||
144 | /* "Paranoia" checks */ | 156 | /* "Paranoia" checks */ |
145 | void | 157 | void |
146 | __jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f); | 158 | __jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f); |
@@ -227,47 +239,11 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs); | |||
227 | #define jffs2_dbg_dump_node(c, ofs) | 239 | #define jffs2_dbg_dump_node(c, ofs) |
228 | #endif /* !JFFS2_DBG_DUMPS */ | 240 | #endif /* !JFFS2_DBG_DUMPS */ |
229 | 241 | ||
230 | /* | ||
231 | * Sanity checks are supposed to be light-weight and enabled by default. | ||
232 | */ | ||
233 | #ifdef JFFS2_DBG_SANITY_CHECKS | 242 | #ifdef JFFS2_DBG_SANITY_CHECKS |
234 | /* | 243 | #define jffs2_dbg_acct_sanity_check(c, jeb) \ |
235 | * Check the space accounting of the file system and of | 244 | __jffs2_dbg_acct_sanity_check(c, jeb) |
236 | * the JFFS2 erasable block 'jeb'. | 245 | #define jffs2_dbg_acct_sanity_check_nolock(c, jeb) \ |
237 | */ | 246 | __jffs2_dbg_acct_sanity_check_nolock(c, jeb) |
238 | static inline void | ||
239 | jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c, | ||
240 | struct jffs2_eraseblock *jeb) | ||
241 | { | ||
242 | if (unlikely(jeb && jeb->used_size + jeb->dirty_size + | ||
243 | jeb->free_size + jeb->wasted_size + | ||
244 | jeb->unchecked_size != c->sector_size)) { | ||
245 | JFFS2_ERROR("eeep, space accounting for block at 0x%08x is screwed.\n", jeb->offset); | ||
246 | JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + wasted %#08x + unchecked " | ||
247 | "%#08x != total %#08x.\n", jeb->free_size, jeb->dirty_size, jeb->used_size, | ||
248 | jeb->wasted_size, jeb->unchecked_size, c->sector_size); | ||
249 | BUG(); | ||
250 | } | ||
251 | |||
252 | if (unlikely(c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size | ||
253 | + c->wasted_size + c->unchecked_size != c->flash_size)) { | ||
254 | JFFS2_ERROR("eeep, space accounting superblock info is screwed.\n"); | ||
255 | JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + " | ||
256 | "wasted %#08x + unchecked %#08x != total %#08x.\n", | ||
257 | c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size, | ||
258 | c->wasted_size, c->unchecked_size, c->flash_size); | ||
259 | BUG(); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | static inline void | ||
264 | jffs2_dbg_acct_sanity_check(struct jffs2_sb_info *c, | ||
265 | struct jffs2_eraseblock *jeb) | ||
266 | { | ||
267 | spin_lock(&c->erase_completion_lock); | ||
268 | jffs2_dbg_acct_sanity_check_nolock(c, jeb); | ||
269 | spin_unlock(&c->erase_completion_lock); | ||
270 | } | ||
271 | #else | 247 | #else |
272 | #define jffs2_dbg_acct_sanity_check(c, jeb) | 248 | #define jffs2_dbg_acct_sanity_check(c, jeb) |
273 | #define jffs2_dbg_acct_sanity_check_nolock(c, jeb) | 249 | #define jffs2_dbg_acct_sanity_check_nolock(c, jeb) |
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index b5f73ab6553c..cd366ab1f020 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: nodelist.c,v 1.108 2005/08/04 11:39:59 dedekind Exp $ | 10 | * $Id: nodelist.c,v 1.109 2005/08/04 11:41:30 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -1010,21 +1010,14 @@ void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c) | |||
1010 | frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb)); | 1010 | frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb)); |
1011 | while(frag) { | 1011 | while(frag) { |
1012 | if (frag->rb.rb_left) { | 1012 | if (frag->rb.rb_left) { |
1013 | JFFS2_DBG_FRAGTREE2("going left from frag (%p) %#04x-%#04x\n", | ||
1014 | frag, frag->ofs, frag->ofs+frag->size); | ||
1015 | frag = frag_left(frag); | 1013 | frag = frag_left(frag); |
1016 | continue; | 1014 | continue; |
1017 | } | 1015 | } |
1018 | if (frag->rb.rb_right) { | 1016 | if (frag->rb.rb_right) { |
1019 | JFFS2_DBG_FRAGTREE2("going right from frag (%p) %#04x-%#04x\n", | ||
1020 | frag, frag->ofs, frag->ofs+frag->size); | ||
1021 | frag = frag_right(frag); | 1017 | frag = frag_right(frag); |
1022 | continue; | 1018 | continue; |
1023 | } | 1019 | } |
1024 | 1020 | ||
1025 | JFFS2_DBG_FRAGTREE2("frag %#04x-%#04x: node %p, frags %d\n", | ||
1026 | frag->ofs, frag->ofs+frag->size, frag->node, frag->node?frag->node->frags:0); | ||
1027 | |||
1028 | if (frag->node && !(--frag->node->frags)) { | 1021 | if (frag->node && !(--frag->node->frags)) { |
1029 | /* Not a hole, and it's the final remaining frag | 1022 | /* Not a hole, and it's the final remaining frag |
1030 | of this node. Free the node */ | 1023 | of this node. Free the node */ |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 12a3aaeb2f7e..50a62dd33e3e 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: readinode.c,v 1.138 2005/08/03 09:28:06 dedekind Exp $ | 10 | * $Id: readinode.c,v 1.139 2005/08/04 11:41:31 dedekind Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -424,7 +424,7 @@ static int read_more(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref, | |||
424 | len = right_size - *rdlen; | 424 | len = right_size - *rdlen; |
425 | } | 425 | } |
426 | 426 | ||
427 | JFFS2_DBG_READINODE("read more %d bytes.", len); | 427 | JFFS2_DBG_READINODE("read more %d bytes\n", len); |
428 | 428 | ||
429 | err = jffs2_flash_read(c, offs, len, &retlen, bufstart); | 429 | err = jffs2_flash_read(c, offs, len, &retlen, bufstart); |
430 | if (err) { | 430 | if (err) { |