summaryrefslogtreecommitdiff
path: root/fs/jffs2/debug.c
diff options
context:
space:
mode:
authorArtem B. Bityutskiy <dedekind@infradead.org>2005-08-05 12:43:47 +0100
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 19:14:35 +0100
commit45ca1b509ea156e87c99e529821fb3b548e14fe3 (patch)
treecd04eb424ea8205f2f2d9e92bf5abfc7431250fc /fs/jffs2/debug.c
parent3c09133739beff0d5ad457dfcfc85c7c350d3661 (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/debug.c')
-rw-r--r--fs/jffs2/debug.c40
1 files changed, 39 insertions, 1 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 @@
*
* 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.