[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>
This commit is contained in:
Artem B. Bityutskiy 2005-08-05 12:43:47 +01:00 committed by Thomas Gleixner
parent 3c09133739
commit 45ca1b509e
4 changed files with 71 additions and 64 deletions

View file

@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: debug.c,v 1.8 2005/07/30 15:27:05 lunn Exp $
* $Id: debug.c,v 1.9 2005/08/05 10:42:24 dedekind Exp $
*
*/
#include <linux/kernel.h>
@ -18,6 +18,44 @@
#include "nodelist.h"
#include "debug.h"
#ifdef JFFS2_DBG_SANITY_CHECKS
void
__jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb)
{
if (unlikely(jeb && jeb->used_size + jeb->dirty_size +
jeb->free_size + jeb->wasted_size +
jeb->unchecked_size != c->sector_size)) {
JFFS2_ERROR("eeep, space accounting for block at 0x%08x is screwed.\n", jeb->offset);
JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + wasted %#08x + unchecked "
"%#08x != total %#08x.\n", jeb->free_size, jeb->dirty_size, jeb->used_size,
jeb->wasted_size, jeb->unchecked_size, c->sector_size);
BUG();
}
if (unlikely(c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size
+ c->wasted_size + c->unchecked_size != c->flash_size)) {
JFFS2_ERROR("eeep, space accounting superblock info is screwed.\n");
JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + "
"wasted %#08x + unchecked %#08x != total %#08x.\n",
c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size,
c->wasted_size, c->unchecked_size, c->flash_size);
BUG();
}
}
void
__jffs2_dbg_acct_sanity_check(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb)
{
spin_lock(&c->erase_completion_lock);
jffs2_dbg_acct_sanity_check_nolock(c, jeb);
spin_unlock(&c->erase_completion_lock);
}
#endif /* JFFS2_DBG_SANITY_CHECKS */
#ifdef JFFS2_DBG_PARANOIA_CHECKS
/*
* Check the fragtree.

View file

@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: debug.h,v 1.10 2005/08/02 10:03:51 dedekind Exp $
* $Id: debug.h,v 1.12 2005/08/05 10:43:47 dedekind Exp $
*
*/
#ifndef _JFFS2_DEBUG_H_
@ -34,7 +34,7 @@
#define JFFS2_DBG_FRAGTREE2_MESSAGES
#endif
/* Enable JFFS2 sanity checks by default */
/* Sanity checks are supposed to be light-weight and enabled by default */
#define JFFS2_DBG_SANITY_CHECKS
/*
@ -55,9 +55,9 @@
/* The prefixes of JFFS2 messages */
#define JFFS2_DBG_MSG_PREFIX "[JFFS2 DBG]"
#define JFFS2_ERR_MSG_PREFIX "JFFS2 error: "
#define JFFS2_WARN_MSG_PREFIX "JFFS2 warning: "
#define JFFS2_NOTICE_MSG_PREFIX "JFFS2 notice: "
#define JFFS2_ERR_MSG_PREFIX "JFFS2 error:"
#define JFFS2_WARN_MSG_PREFIX "JFFS2 warning:"
#define JFFS2_NOTICE_MSG_PREFIX "JFFS2 notice:"
#define JFFS2_ERR_LVL KERN_ERR
#define JFFS2_WARN_LVL KERN_WARNING
@ -67,26 +67,30 @@
/* JFFS2 message macros */
#define JFFS2_ERROR(fmt, ...) \
do { \
printk(JFFS2_ERR_LVL JFFS2_ERR_MSG_PREFIX " %s: " \
fmt, __FUNCTION__, ##__VA_ARGS__); \
printk(JFFS2_ERR_LVL JFFS2_ERR_MSG_PREFIX \
" %d,%s: " fmt, current->pid, \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
#define JFFS2_WARNING(fmt, ...) \
do { \
printk(JFFS2_WARN_LVL JFFS2_WARN_MSG_PREFIX " %s: " \
fmt, __FUNCTION__, ##__VA_ARGS__); \
printk(JFFS2_WARN_LVL JFFS2_WARN_MSG_PREFIX \
" %d,%s: " fmt, current->pid, \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
#define JFFS2_NOTICE(fmt, ...) \
do { \
printk(JFFS2_NOTICE_LVL JFFS2_NOTICE_MSG_PREFIX " %s: " \
fmt, __FUNCTION__, ##__VA_ARGS__); \
printk(JFFS2_NOTICE_LVL JFFS2_NOTICE_MSG_PREFIX \
" %d,%s: " fmt, current->pid, \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
#define JFFS2_DEBUG(fmt, ...) \
do { \
printk(JFFS2_DBG_LVL JFFS2_DBG_MSG_PREFIX " %s: " \
fmt, __FUNCTION__, ##__VA_ARGS__); \
printk(JFFS2_DBG_LVL JFFS2_DBG_MSG_PREFIX \
" %d,%s: " fmt, current->pid, \
__FUNCTION__, ##__VA_ARGS__); \
} while(0)
/*
@ -141,6 +145,14 @@
#endif
/* "Sanity" checks */
void
__jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb);
void
__jffs2_dbg_acct_sanity_check(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb);
/* "Paranoia" checks */
void
__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);
#define jffs2_dbg_dump_node(c, ofs)
#endif /* !JFFS2_DBG_DUMPS */
/*
* Sanity checks are supposed to be light-weight and enabled by default.
*/
#ifdef JFFS2_DBG_SANITY_CHECKS
/*
* Check the space accounting of the file system and of
* the JFFS2 erasable block 'jeb'.
*/
static inline void
jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb)
{
if (unlikely(jeb && jeb->used_size + jeb->dirty_size +
jeb->free_size + jeb->wasted_size +
jeb->unchecked_size != c->sector_size)) {
JFFS2_ERROR("eeep, space accounting for block at 0x%08x is screwed.\n", jeb->offset);
JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + wasted %#08x + unchecked "
"%#08x != total %#08x.\n", jeb->free_size, jeb->dirty_size, jeb->used_size,
jeb->wasted_size, jeb->unchecked_size, c->sector_size);
BUG();
}
if (unlikely(c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size
+ c->wasted_size + c->unchecked_size != c->flash_size)) {
JFFS2_ERROR("eeep, space accounting superblock info is screwed.\n");
JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + "
"wasted %#08x + unchecked %#08x != total %#08x.\n",
c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size,
c->wasted_size, c->unchecked_size, c->flash_size);
BUG();
}
}
static inline void
jffs2_dbg_acct_sanity_check(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb)
{
spin_lock(&c->erase_completion_lock);
jffs2_dbg_acct_sanity_check_nolock(c, jeb);
spin_unlock(&c->erase_completion_lock);
}
#define jffs2_dbg_acct_sanity_check(c, jeb) \
__jffs2_dbg_acct_sanity_check(c, jeb)
#define jffs2_dbg_acct_sanity_check_nolock(c, jeb) \
__jffs2_dbg_acct_sanity_check_nolock(c, jeb)
#else
#define jffs2_dbg_acct_sanity_check(c, jeb)
#define jffs2_dbg_acct_sanity_check_nolock(c, jeb)

View file

@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: nodelist.c,v 1.108 2005/08/04 11:39:59 dedekind Exp $
* $Id: nodelist.c,v 1.109 2005/08/04 11:41:30 dedekind Exp $
*
*/
@ -1010,21 +1010,14 @@ void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c)
frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb));
while(frag) {
if (frag->rb.rb_left) {
JFFS2_DBG_FRAGTREE2("going left from frag (%p) %#04x-%#04x\n",
frag, frag->ofs, frag->ofs+frag->size);
frag = frag_left(frag);
continue;
}
if (frag->rb.rb_right) {
JFFS2_DBG_FRAGTREE2("going right from frag (%p) %#04x-%#04x\n",
frag, frag->ofs, frag->ofs+frag->size);
frag = frag_right(frag);
continue;
}
JFFS2_DBG_FRAGTREE2("frag %#04x-%#04x: node %p, frags %d\n",
frag->ofs, frag->ofs+frag->size, frag->node, frag->node?frag->node->frags:0);
if (frag->node && !(--frag->node->frags)) {
/* Not a hole, and it's the final remaining frag
of this node. Free the node */

View file

@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: readinode.c,v 1.138 2005/08/03 09:28:06 dedekind Exp $
* $Id: readinode.c,v 1.139 2005/08/04 11:41:31 dedekind Exp $
*
*/
@ -424,7 +424,7 @@ static int read_more(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref,
len = right_size - *rdlen;
}
JFFS2_DBG_READINODE("read more %d bytes.", len);
JFFS2_DBG_READINODE("read more %d bytes\n", len);
err = jffs2_flash_read(c, offs, len, &retlen, bufstart);
if (err) {