aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/debug.c')
-rw-r--r--fs/jffs2/debug.c248
1 files changed, 102 insertions, 146 deletions
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c
index 9b776b5a7604..28983501bcef 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.9 2005/08/05 10:42:24 dedekind Exp $ 10 * $Id: debug.c,v 1.10 2005/09/14 16:57:32 dedekind Exp $
11 * 11 *
12 */ 12 */
13#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -28,8 +28,8 @@ __jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c,
28 jeb->free_size + jeb->wasted_size + 28 jeb->free_size + jeb->wasted_size +
29 jeb->unchecked_size != c->sector_size)) { 29 jeb->unchecked_size != c->sector_size)) {
30 JFFS2_ERROR("eeep, space accounting for block at 0x%08x is screwed.\n", jeb->offset); 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 " 31 JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + wasted %#08x + unchecked %#08x != total %#08x.\n",
32 "%#08x != total %#08x.\n", jeb->free_size, jeb->dirty_size, jeb->used_size, 32 jeb->free_size, jeb->dirty_size, jeb->used_size,
33 jeb->wasted_size, jeb->unchecked_size, c->sector_size); 33 jeb->wasted_size, jeb->unchecked_size, c->sector_size);
34 BUG(); 34 BUG();
35 } 35 }
@@ -37,8 +37,7 @@ __jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c,
37 if (unlikely(c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size 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)) { 38 + c->wasted_size + c->unchecked_size != c->flash_size)) {
39 JFFS2_ERROR("eeep, space accounting superblock info is screwed.\n"); 39 JFFS2_ERROR("eeep, space accounting superblock info is screwed.\n");
40 JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + " 40 JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + wasted %#08x + unchecked %#08x != total %#08x.\n",
41 "wasted %#08x + unchecked %#08x != total %#08x.\n",
42 c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size, 41 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); 42 c->wasted_size, c->unchecked_size, c->flash_size);
44 BUG(); 43 BUG();
@@ -83,7 +82,7 @@ __jffs2_dbg_fragtree_paranoia_check_nolock(struct jffs2_inode_info *f)
83 if (ref_flags(fn->raw) == REF_PRISTINE) { 82 if (ref_flags(fn->raw) == REF_PRISTINE) {
84 if (fn->frags > 1) { 83 if (fn->frags > 1) {
85 JFFS2_ERROR("REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2.\n", 84 JFFS2_ERROR("REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2.\n",
86 ref_offset(fn->raw), fn->frags); 85 ref_offset(fn->raw), fn->frags);
87 bitched = 1; 86 bitched = 1;
88 } 87 }
89 88
@@ -94,16 +93,15 @@ __jffs2_dbg_fragtree_paranoia_check_nolock(struct jffs2_inode_info *f)
94 to tell a hole node. */ 93 to tell a hole node. */
95 if (frag->ofs & (PAGE_CACHE_SIZE-1) && frag_prev(frag) 94 if (frag->ofs & (PAGE_CACHE_SIZE-1) && frag_prev(frag)
96 && frag_prev(frag)->size < PAGE_CACHE_SIZE && frag_prev(frag)->node) { 95 && frag_prev(frag)->size < PAGE_CACHE_SIZE && frag_prev(frag)->node) {
97 JFFS2_ERROR("REF_PRISTINE node at 0x%08x had a previous non-hole frag " 96 JFFS2_ERROR("REF_PRISTINE node at 0x%08x had a previous non-hole frag in the same page. Tell dwmw2.\n",
98 "in the same page. Tell dwmw2.\n", ref_offset(fn->raw)); 97 ref_offset(fn->raw));
99 bitched = 1; 98 bitched = 1;
100 } 99 }
101 100
102 if ((frag->ofs+frag->size) & (PAGE_CACHE_SIZE-1) && frag_next(frag) 101 if ((frag->ofs+frag->size) & (PAGE_CACHE_SIZE-1) && frag_next(frag)
103 && frag_next(frag)->size < PAGE_CACHE_SIZE && frag_next(frag)->node) { 102 && frag_next(frag)->size < PAGE_CACHE_SIZE && frag_next(frag)->node) {
104 JFFS2_ERROR("REF_PRISTINE node at 0x%08x (%08x-%08x) had a following " 103 JFFS2_ERROR("REF_PRISTINE node at 0x%08x (%08x-%08x) had a following non-hole frag in the same page. Tell dwmw2.\n",
105 "non-hole frag in the same page. Tell dwmw2.\n", 104 ref_offset(fn->raw), frag->ofs, frag->ofs+frag->size);
106 ref_offset(fn->raw), frag->ofs, frag->ofs+frag->size);
107 bitched = 1; 105 bitched = 1;
108 } 106 }
109 } 107 }
@@ -145,8 +143,8 @@ __jffs2_dbg_prewrite_paranoia_check(struct jffs2_sb_info *c,
145 ret = 1; 143 ret = 1;
146 144
147 if (ret) { 145 if (ret) {
148 JFFS2_ERROR("argh, about to write node to %#08x on flash, but there are data " 146 JFFS2_ERROR("argh, about to write node to %#08x on flash, but there are data already there. The first corrupted byte is at %#08x offset.\n",
149 "already there. The first corrupted byte is at %#08x offset.\n", ofs, ofs + i); 147 ofs, ofs + i);
150 __jffs2_dbg_dump_buffer(buf, len, ofs); 148 __jffs2_dbg_dump_buffer(buf, len, ofs);
151 kfree(buf); 149 kfree(buf);
152 BUG(); 150 BUG();
@@ -194,8 +192,7 @@ __jffs2_dbg_acct_paranoia_check_nolock(struct jffs2_sb_info *c,
194 my_dirty_size += totlen; 192 my_dirty_size += totlen;
195 193
196 if ((!ref2->next_phys) != (ref2 == jeb->last_node)) { 194 if ((!ref2->next_phys) != (ref2 == jeb->last_node)) {
197 JFFS2_ERROR("node_ref for node at %#08x (mem %p) has next_phys at %#08x (mem %p), " 195 JFFS2_ERROR("node_ref for node at %#08x (mem %p) has next_phys at %#08x (mem %p), last_node is at %#08x (mem %p).\n",
198 "last_node is at %#08x (mem %p).\n",
199 ref_offset(ref2), ref2, ref_offset(ref2->next_phys), ref2->next_phys, 196 ref_offset(ref2), ref2, ref_offset(ref2->next_phys), ref2->next_phys,
200 ref_offset(jeb->last_node), jeb->last_node); 197 ref_offset(jeb->last_node), jeb->last_node);
201 goto error; 198 goto error;
@@ -263,13 +260,13 @@ __jffs2_dbg_dump_node_refs_nolock(struct jffs2_sb_info *c,
263 struct jffs2_raw_node_ref *ref; 260 struct jffs2_raw_node_ref *ref;
264 int i = 0; 261 int i = 0;
265 262
266 JFFS2_DEBUG("Dump node_refs of the eraseblock %#08x\n", jeb->offset); 263 printk(JFFS2_DBG_MSG_PREFIX " Dump node_refs of the eraseblock %#08x\n", jeb->offset);
267 if (!jeb->first_node) { 264 if (!jeb->first_node) {
268 JFFS2_DEBUG("no nodes in the eraseblock %#08x\n", jeb->offset); 265 printk(JFFS2_DBG_MSG_PREFIX " no nodes in the eraseblock %#08x\n", jeb->offset);
269 return; 266 return;
270 } 267 }
271 268
272 printk(JFFS2_DBG_LVL); 269 printk(JFFS2_DBG);
273 for (ref = jeb->first_node; ; ref = ref->next_phys) { 270 for (ref = jeb->first_node; ; ref = ref->next_phys) {
274 printk("%#08x(%#x)", ref_offset(ref), ref->__totlen); 271 printk("%#08x(%#x)", ref_offset(ref), ref->__totlen);
275 if (ref->next_phys) 272 if (ref->next_phys)
@@ -278,7 +275,7 @@ __jffs2_dbg_dump_node_refs_nolock(struct jffs2_sb_info *c,
278 break; 275 break;
279 if (++i == 4) { 276 if (++i == 4) {
280 i = 0; 277 i = 0;
281 printk("\n" JFFS2_DBG_LVL); 278 printk("\n" JFFS2_DBG);
282 } 279 }
283 } 280 }
284 printk("\n"); 281 printk("\n");
@@ -301,14 +298,14 @@ __jffs2_dbg_dump_jeb_nolock(struct jffs2_eraseblock *jeb)
301 if (!jeb) 298 if (!jeb)
302 return; 299 return;
303 300
304 JFFS2_DEBUG("dump space accounting for the eraseblock at %#08x:\n", 301 printk(JFFS2_DBG_MSG_PREFIX " dump space accounting for the eraseblock at %#08x:\n",
305 jeb->offset); 302 jeb->offset);
306 303
307 printk(JFFS2_DBG_LVL "used_size: %#08x\n", jeb->used_size); 304 printk(JFFS2_DBG "used_size: %#08x\n", jeb->used_size);
308 printk(JFFS2_DBG_LVL "dirty_size: %#08x\n", jeb->dirty_size); 305 printk(JFFS2_DBG "dirty_size: %#08x\n", jeb->dirty_size);
309 printk(JFFS2_DBG_LVL "wasted_size: %#08x\n", jeb->wasted_size); 306 printk(JFFS2_DBG "wasted_size: %#08x\n", jeb->wasted_size);
310 printk(JFFS2_DBG_LVL "unchecked_size: %#08x\n", jeb->unchecked_size); 307 printk(JFFS2_DBG "unchecked_size: %#08x\n", jeb->unchecked_size);
311 printk(JFFS2_DBG_LVL "free_size: %#08x\n", jeb->free_size); 308 printk(JFFS2_DBG "free_size: %#08x\n", jeb->free_size);
312} 309}
313 310
314void 311void
@@ -322,39 +319,37 @@ __jffs2_dbg_dump_block_lists(struct jffs2_sb_info *c)
322void 319void
323__jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c) 320__jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
324{ 321{
325 JFFS2_DEBUG("dump JFFS2 blocks lists:\n"); 322 printk(JFFS2_DBG_MSG_PREFIX " dump JFFS2 blocks lists:\n");
326 323
327 printk(JFFS2_DBG_LVL "flash_size: %#08x\n", c->flash_size); 324 printk(JFFS2_DBG "flash_size: %#08x\n", c->flash_size);
328 printk(JFFS2_DBG_LVL "used_size: %#08x\n", c->used_size); 325 printk(JFFS2_DBG "used_size: %#08x\n", c->used_size);
329 printk(JFFS2_DBG_LVL "dirty_size: %#08x\n", c->dirty_size); 326 printk(JFFS2_DBG "dirty_size: %#08x\n", c->dirty_size);
330 printk(JFFS2_DBG_LVL "wasted_size: %#08x\n", c->wasted_size); 327 printk(JFFS2_DBG "wasted_size: %#08x\n", c->wasted_size);
331 printk(JFFS2_DBG_LVL "unchecked_size: %#08x\n", c->unchecked_size); 328 printk(JFFS2_DBG "unchecked_size: %#08x\n", c->unchecked_size);
332 printk(JFFS2_DBG_LVL "free_size: %#08x\n", c->free_size); 329 printk(JFFS2_DBG "free_size: %#08x\n", c->free_size);
333 printk(JFFS2_DBG_LVL "erasing_size: %#08x\n", c->erasing_size); 330 printk(JFFS2_DBG "erasing_size: %#08x\n", c->erasing_size);
334 printk(JFFS2_DBG_LVL "bad_size: %#08x\n", c->bad_size); 331 printk(JFFS2_DBG "bad_size: %#08x\n", c->bad_size);
335 printk(JFFS2_DBG_LVL "sector_size: %#08x\n", c->sector_size); 332 printk(JFFS2_DBG "sector_size: %#08x\n", c->sector_size);
336 printk(JFFS2_DBG_LVL "jffs2_reserved_blocks size: %#08x\n", 333 printk(JFFS2_DBG "jffs2_reserved_blocks size: %#08x\n",
337 c->sector_size * c->resv_blocks_write); 334 c->sector_size * c->resv_blocks_write);
338 335
339 if (c->nextblock) 336 if (c->nextblock)
340 printk(JFFS2_DBG_LVL "nextblock: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 337 printk(JFFS2_DBG "nextblock: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
341 "unchecked %#08x, free %#08x)\n",
342 c->nextblock->offset, c->nextblock->used_size, 338 c->nextblock->offset, c->nextblock->used_size,
343 c->nextblock->dirty_size, c->nextblock->wasted_size, 339 c->nextblock->dirty_size, c->nextblock->wasted_size,
344 c->nextblock->unchecked_size, c->nextblock->free_size); 340 c->nextblock->unchecked_size, c->nextblock->free_size);
345 else 341 else
346 printk(JFFS2_DBG_LVL "nextblock: NULL\n"); 342 printk(JFFS2_DBG "nextblock: NULL\n");
347 343
348 if (c->gcblock) 344 if (c->gcblock)
349 printk(JFFS2_DBG_LVL "gcblock: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 345 printk(JFFS2_DBG "gcblock: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
350 "unchecked %#08x, free %#08x)\n",
351 c->gcblock->offset, c->gcblock->used_size, c->gcblock->dirty_size, 346 c->gcblock->offset, c->gcblock->used_size, c->gcblock->dirty_size,
352 c->gcblock->wasted_size, c->gcblock->unchecked_size, c->gcblock->free_size); 347 c->gcblock->wasted_size, c->gcblock->unchecked_size, c->gcblock->free_size);
353 else 348 else
354 printk(JFFS2_DBG_LVL "gcblock: NULL\n"); 349 printk(JFFS2_DBG "gcblock: NULL\n");
355 350
356 if (list_empty(&c->clean_list)) { 351 if (list_empty(&c->clean_list)) {
357 printk(JFFS2_DBG_LVL "clean_list: empty\n"); 352 printk(JFFS2_DBG "clean_list: empty\n");
358 } else { 353 } else {
359 struct list_head *this; 354 struct list_head *this;
360 int numblocks = 0; 355 int numblocks = 0;
@@ -365,19 +360,18 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
365 numblocks ++; 360 numblocks ++;
366 dirty += jeb->wasted_size; 361 dirty += jeb->wasted_size;
367 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 362 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
368 printk(JFFS2_DBG_LVL "clean_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 363 printk(JFFS2_DBG "clean_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
369 "unchecked %#08x, free %#08x)\n",
370 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 364 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
371 jeb->unchecked_size, jeb->free_size); 365 jeb->unchecked_size, jeb->free_size);
372 } 366 }
373 } 367 }
374 368
375 printk (JFFS2_DBG_LVL "Contains %d blocks with total wasted size %u, average wasted size: %u\n", 369 printk (JFFS2_DBG "Contains %d blocks with total wasted size %u, average wasted size: %u\n",
376 numblocks, dirty, dirty / numblocks); 370 numblocks, dirty, dirty / numblocks);
377 } 371 }
378 372
379 if (list_empty(&c->very_dirty_list)) { 373 if (list_empty(&c->very_dirty_list)) {
380 printk(JFFS2_DBG_LVL "very_dirty_list: empty\n"); 374 printk(JFFS2_DBG "very_dirty_list: empty\n");
381 } else { 375 } else {
382 struct list_head *this; 376 struct list_head *this;
383 int numblocks = 0; 377 int numblocks = 0;
@@ -389,19 +383,18 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
389 numblocks ++; 383 numblocks ++;
390 dirty += jeb->dirty_size; 384 dirty += jeb->dirty_size;
391 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 385 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
392 printk(JFFS2_DBG_LVL "very_dirty_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 386 printk(JFFS2_DBG "very_dirty_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
393 "unchecked %#08x, free %#08x)\n",
394 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 387 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
395 jeb->unchecked_size, jeb->free_size); 388 jeb->unchecked_size, jeb->free_size);
396 } 389 }
397 } 390 }
398 391
399 printk (JFFS2_DBG_LVL "Contains %d blocks with total dirty size %u, average dirty size: %u\n", 392 printk (JFFS2_DBG "Contains %d blocks with total dirty size %u, average dirty size: %u\n",
400 numblocks, dirty, dirty / numblocks); 393 numblocks, dirty, dirty / numblocks);
401 } 394 }
402 395
403 if (list_empty(&c->dirty_list)) { 396 if (list_empty(&c->dirty_list)) {
404 printk(JFFS2_DBG_LVL "dirty_list: empty\n"); 397 printk(JFFS2_DBG "dirty_list: empty\n");
405 } else { 398 } else {
406 struct list_head *this; 399 struct list_head *this;
407 int numblocks = 0; 400 int numblocks = 0;
@@ -413,19 +406,18 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
413 numblocks ++; 406 numblocks ++;
414 dirty += jeb->dirty_size; 407 dirty += jeb->dirty_size;
415 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 408 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
416 printk(JFFS2_DBG_LVL "dirty_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 409 printk(JFFS2_DBG "dirty_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
417 "unchecked %#08x, free %#08x)\n",
418 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 410 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
419 jeb->unchecked_size, jeb->free_size); 411 jeb->unchecked_size, jeb->free_size);
420 } 412 }
421 } 413 }
422 414
423 printk (JFFS2_DBG_LVL "contains %d blocks with total dirty size %u, average dirty size: %u\n", 415 printk (JFFS2_DBG "contains %d blocks with total dirty size %u, average dirty size: %u\n",
424 numblocks, dirty, dirty / numblocks); 416 numblocks, dirty, dirty / numblocks);
425 } 417 }
426 418
427 if (list_empty(&c->erasable_list)) { 419 if (list_empty(&c->erasable_list)) {
428 printk(JFFS2_DBG_LVL "erasable_list: empty\n"); 420 printk(JFFS2_DBG "erasable_list: empty\n");
429 } else { 421 } else {
430 struct list_head *this; 422 struct list_head *this;
431 423
@@ -433,8 +425,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
433 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); 425 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
434 426
435 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 427 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
436 printk(JFFS2_DBG_LVL "erasable_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 428 printk(JFFS2_DBG "erasable_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
437 "unchecked %#08x, free %#08x)\n",
438 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 429 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
439 jeb->unchecked_size, jeb->free_size); 430 jeb->unchecked_size, jeb->free_size);
440 } 431 }
@@ -442,7 +433,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
442 } 433 }
443 434
444 if (list_empty(&c->erasing_list)) { 435 if (list_empty(&c->erasing_list)) {
445 printk(JFFS2_DBG_LVL "erasing_list: empty\n"); 436 printk(JFFS2_DBG "erasing_list: empty\n");
446 } else { 437 } else {
447 struct list_head *this; 438 struct list_head *this;
448 439
@@ -450,8 +441,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
450 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); 441 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
451 442
452 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 443 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
453 printk(JFFS2_DBG_LVL "erasing_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 444 printk(JFFS2_DBG "erasing_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
454 "unchecked %#08x, free %#08x)\n",
455 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 445 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
456 jeb->unchecked_size, jeb->free_size); 446 jeb->unchecked_size, jeb->free_size);
457 } 447 }
@@ -459,7 +449,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
459 } 449 }
460 450
461 if (list_empty(&c->erase_pending_list)) { 451 if (list_empty(&c->erase_pending_list)) {
462 printk(JFFS2_DBG_LVL "erase_pending_list: empty\n"); 452 printk(JFFS2_DBG "erase_pending_list: empty\n");
463 } else { 453 } else {
464 struct list_head *this; 454 struct list_head *this;
465 455
@@ -467,8 +457,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
467 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); 457 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
468 458
469 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 459 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
470 printk(JFFS2_DBG_LVL "erase_pending_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 460 printk(JFFS2_DBG "erase_pending_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
471 "unchecked %#08x, free %#08x)\n",
472 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 461 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
473 jeb->unchecked_size, jeb->free_size); 462 jeb->unchecked_size, jeb->free_size);
474 } 463 }
@@ -476,7 +465,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
476 } 465 }
477 466
478 if (list_empty(&c->erasable_pending_wbuf_list)) { 467 if (list_empty(&c->erasable_pending_wbuf_list)) {
479 printk(JFFS2_DBG_LVL "erasable_pending_wbuf_list: empty\n"); 468 printk(JFFS2_DBG "erasable_pending_wbuf_list: empty\n");
480 } else { 469 } else {
481 struct list_head *this; 470 struct list_head *this;
482 471
@@ -484,8 +473,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
484 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); 473 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
485 474
486 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 475 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
487 printk(JFFS2_DBG_LVL "erasable_pending_wbuf_list: %#08x (used %#08x, dirty %#08x, " 476 printk(JFFS2_DBG "erasable_pending_wbuf_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
488 "wasted %#08x, unchecked %#08x, free %#08x)\n",
489 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 477 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
490 jeb->unchecked_size, jeb->free_size); 478 jeb->unchecked_size, jeb->free_size);
491 } 479 }
@@ -493,7 +481,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
493 } 481 }
494 482
495 if (list_empty(&c->free_list)) { 483 if (list_empty(&c->free_list)) {
496 printk(JFFS2_DBG_LVL "free_list: empty\n"); 484 printk(JFFS2_DBG "free_list: empty\n");
497 } else { 485 } else {
498 struct list_head *this; 486 struct list_head *this;
499 487
@@ -501,8 +489,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
501 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); 489 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
502 490
503 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 491 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
504 printk(JFFS2_DBG_LVL "free_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 492 printk(JFFS2_DBG "free_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
505 "unchecked %#08x, free %#08x)\n",
506 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 493 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
507 jeb->unchecked_size, jeb->free_size); 494 jeb->unchecked_size, jeb->free_size);
508 } 495 }
@@ -510,7 +497,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
510 } 497 }
511 498
512 if (list_empty(&c->bad_list)) { 499 if (list_empty(&c->bad_list)) {
513 printk(JFFS2_DBG_LVL "bad_list: empty\n"); 500 printk(JFFS2_DBG "bad_list: empty\n");
514 } else { 501 } else {
515 struct list_head *this; 502 struct list_head *this;
516 503
@@ -518,8 +505,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
518 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); 505 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
519 506
520 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 507 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
521 printk(JFFS2_DBG_LVL "bad_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 508 printk(JFFS2_DBG "bad_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
522 "unchecked %#08x, free %#08x)\n",
523 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 509 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
524 jeb->unchecked_size, jeb->free_size); 510 jeb->unchecked_size, jeb->free_size);
525 } 511 }
@@ -527,7 +513,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
527 } 513 }
528 514
529 if (list_empty(&c->bad_used_list)) { 515 if (list_empty(&c->bad_used_list)) {
530 printk(JFFS2_DBG_LVL "bad_used_list: empty\n"); 516 printk(JFFS2_DBG "bad_used_list: empty\n");
531 } else { 517 } else {
532 struct list_head *this; 518 struct list_head *this;
533 519
@@ -535,8 +521,7 @@ __jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
535 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); 521 struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
536 522
537 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { 523 if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) {
538 printk(JFFS2_DBG_LVL "bad_used_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " 524 printk(JFFS2_DBG "bad_used_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, unchecked %#08x, free %#08x)\n",
539 "unchecked %#08x, free %#08x)\n",
540 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, 525 jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size,
541 jeb->unchecked_size, jeb->free_size); 526 jeb->unchecked_size, jeb->free_size);
542 } 527 }
@@ -559,16 +544,15 @@ __jffs2_dbg_dump_fragtree_nolock(struct jffs2_inode_info *f)
559 uint32_t lastofs = 0; 544 uint32_t lastofs = 0;
560 int buggy = 0; 545 int buggy = 0;
561 546
562 JFFS2_DEBUG("dump fragtree of ino #%u\n", f->inocache->ino); 547 printk(JFFS2_DBG_MSG_PREFIX " dump fragtree of ino #%u\n", f->inocache->ino);
563 while(this) { 548 while(this) {
564 if (this->node) 549 if (this->node)
565 printk(JFFS2_DBG_LVL "frag %#04x-%#04x: %#08x(%d) on flash (*%p), left (%p), " 550 printk(JFFS2_DBG "frag %#04x-%#04x: %#08x(%d) on flash (*%p), left (%p), right (%p), parent (%p)\n",
566 "right (%p), parent (%p)\n",
567 this->ofs, this->ofs+this->size, ref_offset(this->node->raw), 551 this->ofs, this->ofs+this->size, ref_offset(this->node->raw),
568 ref_flags(this->node->raw), this, frag_left(this), frag_right(this), 552 ref_flags(this->node->raw), this, frag_left(this), frag_right(this),
569 frag_parent(this)); 553 frag_parent(this));
570 else 554 else
571 printk(JFFS2_DBG_LVL "frag %#04x-%#04x: hole (*%p). left (%p), right (%p), parent (%p)\n", 555 printk(JFFS2_DBG "frag %#04x-%#04x: hole (*%p). left (%p), right (%p), parent (%p)\n",
572 this->ofs, this->ofs+this->size, this, frag_left(this), 556 this->ofs, this->ofs+this->size, this, frag_left(this),
573 frag_right(this), frag_parent(this)); 557 frag_right(this), frag_parent(this));
574 if (this->ofs != lastofs) 558 if (this->ofs != lastofs)
@@ -578,7 +562,7 @@ __jffs2_dbg_dump_fragtree_nolock(struct jffs2_inode_info *f)
578 } 562 }
579 563
580 if (f->metadata) 564 if (f->metadata)
581 printk(JFFS2_DBG_LVL "metadata at 0x%08x\n", ref_offset(f->metadata->raw)); 565 printk(JFFS2_DBG "metadata at 0x%08x\n", ref_offset(f->metadata->raw));
582 566
583 if (buggy) { 567 if (buggy) {
584 JFFS2_ERROR("frag tree got a hole in it.\n"); 568 JFFS2_ERROR("frag tree got a hole in it.\n");
@@ -593,13 +577,13 @@ __jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs)
593 int skip; 577 int skip;
594 int i; 578 int i;
595 579
596 JFFS2_DEBUG("dump from offset %#08x to offset %#08x (%x bytes).\n", 580 printk(JFFS2_DBG_MSG_PREFIX " dump from offset %#08x to offset %#08x (%x bytes).\n",
597 offs, offs + len, len); 581 offs, offs + len, len);
598 i = skip = offs % JFFS2_BUFDUMP_BYTES_PER_LINE; 582 i = skip = offs % JFFS2_BUFDUMP_BYTES_PER_LINE;
599 offs = offs & ~(JFFS2_BUFDUMP_BYTES_PER_LINE - 1); 583 offs = offs & ~(JFFS2_BUFDUMP_BYTES_PER_LINE - 1);
600 584
601 if (skip != 0) 585 if (skip != 0)
602 printk(JFFS2_DBG_LVL "%#08x: ", offs); 586 printk(JFFS2_DBG "%#08x: ", offs);
603 587
604 while (skip--) 588 while (skip--)
605 printk(" "); 589 printk(" ");
@@ -609,7 +593,7 @@ __jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs)
609 if (i != 0) 593 if (i != 0)
610 printk("\n"); 594 printk("\n");
611 offs += JFFS2_BUFDUMP_BYTES_PER_LINE; 595 offs += JFFS2_BUFDUMP_BYTES_PER_LINE;
612 printk(JFFS2_DBG_LVL "%0#8x: ", offs); 596 printk(JFFS2_DBG "%0#8x: ", offs);
613 } 597 }
614 598
615 printk("%02x ", buf[i]); 599 printk("%02x ", buf[i]);
@@ -632,7 +616,7 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
632 uint32_t crc; 616 uint32_t crc;
633 int ret; 617 int ret;
634 618
635 JFFS2_DEBUG("dump node at offset %#08x.\n", ofs); 619 printk(JFFS2_DBG_MSG_PREFIX " dump node at offset %#08x.\n", ofs);
636 620
637 ret = jffs2_flash_read(c, ofs, len, &retlen, (unsigned char *)&node); 621 ret = jffs2_flash_read(c, ofs, len, &retlen, (unsigned char *)&node);
638 if (ret || (retlen != len)) { 622 if (ret || (retlen != len)) {
@@ -641,14 +625,10 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
641 return; 625 return;
642 } 626 }
643 627
644 printk(JFFS2_DBG_LVL "magic:\t%#04x\n", 628 printk(JFFS2_DBG "magic:\t%#04x\n", je16_to_cpu(node.u.magic));
645 je16_to_cpu(node.u.magic)); 629 printk(JFFS2_DBG "nodetype:\t%#04x\n", je16_to_cpu(node.u.nodetype));
646 printk(JFFS2_DBG_LVL "nodetype:\t%#04x\n", 630 printk(JFFS2_DBG "totlen:\t%#08x\n", je32_to_cpu(node.u.totlen));
647 je16_to_cpu(node.u.nodetype)); 631 printk(JFFS2_DBG "hdr_crc:\t%#08x\n", je32_to_cpu(node.u.hdr_crc));
648 printk(JFFS2_DBG_LVL "totlen:\t%#08x\n",
649 je32_to_cpu(node.u.totlen));
650 printk(JFFS2_DBG_LVL "hdr_crc:\t%#08x\n",
651 je32_to_cpu(node.u.hdr_crc));
652 632
653 crc = crc32(0, &node.u, sizeof(node.u) - 4); 633 crc = crc32(0, &node.u, sizeof(node.u) - 4);
654 if (crc != je32_to_cpu(node.u.hdr_crc)) { 634 if (crc != je32_to_cpu(node.u.hdr_crc)) {
@@ -668,41 +648,25 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
668 648
669 case JFFS2_NODETYPE_INODE: 649 case JFFS2_NODETYPE_INODE:
670 650
671 printk(JFFS2_DBG_LVL "the node is inode node\n"); 651 printk(JFFS2_DBG "the node is inode node\n");
672 printk(JFFS2_DBG_LVL "ino:\t%#08x\n", 652 printk(JFFS2_DBG "ino:\t%#08x\n", je32_to_cpu(node.i.ino));
673 je32_to_cpu(node.i.ino)); 653 printk(JFFS2_DBG "version:\t%#08x\n", je32_to_cpu(node.i.version));
674 printk(JFFS2_DBG_LVL "version:\t%#08x\n", 654 printk(JFFS2_DBG "mode:\t%#08x\n", node.i.mode.m);
675 je32_to_cpu(node.i.version)); 655 printk(JFFS2_DBG "uid:\t%#04x\n", je16_to_cpu(node.i.uid));
676 printk(JFFS2_DBG_LVL "mode:\t%#08x\n", 656 printk(JFFS2_DBG "gid:\t%#04x\n", je16_to_cpu(node.i.gid));
677 node.i.mode.m); 657 printk(JFFS2_DBG "isize:\t%#08x\n", je32_to_cpu(node.i.isize));
678 printk(JFFS2_DBG_LVL "uid:\t%#04x\n", 658 printk(JFFS2_DBG "atime:\t%#08x\n", je32_to_cpu(node.i.atime));
679 je16_to_cpu(node.i.uid)); 659 printk(JFFS2_DBG "mtime:\t%#08x\n", je32_to_cpu(node.i.mtime));
680 printk(JFFS2_DBG_LVL "gid:\t%#04x\n", 660 printk(JFFS2_DBG "ctime:\t%#08x\n", je32_to_cpu(node.i.ctime));
681 je16_to_cpu(node.i.gid)); 661 printk(JFFS2_DBG "offset:\t%#08x\n", je32_to_cpu(node.i.offset));
682 printk(JFFS2_DBG_LVL "isize:\t%#08x\n", 662 printk(JFFS2_DBG "csize:\t%#08x\n", je32_to_cpu(node.i.csize));
683 je32_to_cpu(node.i.isize)); 663 printk(JFFS2_DBG "dsize:\t%#08x\n", je32_to_cpu(node.i.dsize));
684 printk(JFFS2_DBG_LVL "atime:\t%#08x\n", 664 printk(JFFS2_DBG "compr:\t%#02x\n", node.i.compr);
685 je32_to_cpu(node.i.atime)); 665 printk(JFFS2_DBG "usercompr:\t%#02x\n", node.i.usercompr);
686 printk(JFFS2_DBG_LVL "mtime:\t%#08x\n", 666 printk(JFFS2_DBG "flags:\t%#04x\n", je16_to_cpu(node.i.flags));
687 je32_to_cpu(node.i.mtime)); 667 printk(JFFS2_DBG "data_crc:\t%#08x\n", je32_to_cpu(node.i.data_crc));
688 printk(JFFS2_DBG_LVL "ctime:\t%#08x\n", 668 printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.i.node_crc));
689 je32_to_cpu(node.i.ctime)); 669
690 printk(JFFS2_DBG_LVL "offset:\t%#08x\n",
691 je32_to_cpu(node.i.offset));
692 printk(JFFS2_DBG_LVL "csize:\t%#08x\n",
693 je32_to_cpu(node.i.csize));
694 printk(JFFS2_DBG_LVL "dsize:\t%#08x\n",
695 je32_to_cpu(node.i.dsize));
696 printk(JFFS2_DBG_LVL "compr:\t%#02x\n",
697 node.i.compr);
698 printk(JFFS2_DBG_LVL "usercompr:\t%#02x\n",
699 node.i.usercompr);
700 printk(JFFS2_DBG_LVL "flags:\t%#04x\n",
701 je16_to_cpu(node.i.flags));
702 printk(JFFS2_DBG_LVL "data_crc:\t%#08x\n",
703 je32_to_cpu(node.i.data_crc));
704 printk(JFFS2_DBG_LVL "node_crc:\t%#08x\n",
705 je32_to_cpu(node.i.node_crc));
706 crc = crc32(0, &node.i, sizeof(node.i) - 8); 670 crc = crc32(0, &node.i, sizeof(node.i) - 8);
707 if (crc != je32_to_cpu(node.i.node_crc)) { 671 if (crc != je32_to_cpu(node.i.node_crc)) {
708 JFFS2_ERROR("wrong node header CRC.\n"); 672 JFFS2_ERROR("wrong node header CRC.\n");
@@ -712,26 +676,18 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
712 676
713 case JFFS2_NODETYPE_DIRENT: 677 case JFFS2_NODETYPE_DIRENT:
714 678
715 printk(JFFS2_DBG_LVL "the node is dirent node\n"); 679 printk(JFFS2_DBG "the node is dirent node\n");
716 printk(JFFS2_DBG_LVL "pino:\t%#08x\n", 680 printk(JFFS2_DBG "pino:\t%#08x\n", je32_to_cpu(node.d.pino));
717 je32_to_cpu(node.d.pino)); 681 printk(JFFS2_DBG "version:\t%#08x\n", je32_to_cpu(node.d.version));
718 printk(JFFS2_DBG_LVL "version:\t%#08x\n", 682 printk(JFFS2_DBG "ino:\t%#08x\n", je32_to_cpu(node.d.ino));
719 je32_to_cpu(node.d.version)); 683 printk(JFFS2_DBG "mctime:\t%#08x\n", je32_to_cpu(node.d.mctime));
720 printk(JFFS2_DBG_LVL "ino:\t%#08x\n", 684 printk(JFFS2_DBG "nsize:\t%#02x\n", node.d.nsize);
721 je32_to_cpu(node.d.ino)); 685 printk(JFFS2_DBG "type:\t%#02x\n", node.d.type);
722 printk(JFFS2_DBG_LVL "mctime:\t%#08x\n", 686 printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.d.node_crc));
723 je32_to_cpu(node.d.mctime)); 687 printk(JFFS2_DBG "name_crc:\t%#08x\n", je32_to_cpu(node.d.name_crc));
724 printk(JFFS2_DBG_LVL "nsize:\t%#02x\n",
725 node.d.nsize);
726 printk(JFFS2_DBG_LVL "type:\t%#02x\n",
727 node.d.type);
728 printk(JFFS2_DBG_LVL "node_crc:\t%#08x\n",
729 je32_to_cpu(node.d.node_crc));
730 printk(JFFS2_DBG_LVL "name_crc:\t%#08x\n",
731 je32_to_cpu(node.d.name_crc));
732 688
733 node.d.name[node.d.nsize] = '\0'; 689 node.d.name[node.d.nsize] = '\0';
734 printk(JFFS2_DBG_LVL "name:\t\"%s\"\n", node.d.name); 690 printk(JFFS2_DBG "name:\t\"%s\"\n", node.d.name);
735 691
736 crc = crc32(0, &node.d, sizeof(node.d) - 8); 692 crc = crc32(0, &node.d, sizeof(node.d) - 8);
737 if (crc != je32_to_cpu(node.d.node_crc)) { 693 if (crc != je32_to_cpu(node.d.node_crc)) {
@@ -741,7 +697,7 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
741 break; 697 break;
742 698
743 default: 699 default:
744 printk(JFFS2_DBG_LVL "node type is unknown\n"); 700 printk(JFFS2_DBG "node type is unknown\n");
745 break; 701 break;
746 } 702 }
747} 703}