mtd/fs/jffs3 debug.h,1.3,1.4

Artem Bityuckiy dedekind at infradead.org
Thu Dec 16 11:46:38 EST 2004


Update of /home/cvs/mtd/fs/jffs3
In directory phoenix.infradead.org:/tmp/cvs-serv9682

Modified Files:
	debug.h 
Log Message:
Add GC subsystem macros.


Index: debug.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- debug.h	13 Dec 2004 19:00:12 -0000	1.3
+++ debug.h	16 Dec 2004 16:46:34 -0000	1.4
@@ -16,20 +16,28 @@
 #include <linux/kernel.h>
 #include "jffs3.h"
 
-#define JFFS3_DBG_SANITY_CHECKS
+/*
+ * Sanity checks are supposed to be quick and are always enabled. When the correspondent
+ * part of JFFS3 is conciedered stable, the sanity check is moved to paranoid check and is
+ * disabled by default. If it is wanted to make JFFS3 a bit faster, sanity checks may be disabled.
+ */
+#define JFFS3_DBG_SANITY_CHECKS	1
 
 /* JFFS3 subsystems */
-#define JFFS3_DBG_OTHER	1
-#define JFFS3_DBG_SCAN	2
+#define JFFS3_DBG_OTHER	1	/* Not classified */
+#define JFFS3_DBG_SCAN	2	/* Flash scan */
+#define JFFS3_DBG_GC	3	/* Garbage Collector */
 
 #if CONFIG_JFFS3_FS_DEBUG > 0
-#define JFFS3_DBG_PARANOIA_CHECKS	1	/* By default enable all paranoid checks */
+#define JFFS3_DBG_PARANOIA_CHECKS	1
 /* By default print the debugging messages from any JFFS3 subsystem */
 #define JFFS3_DBG_SUBSYS_OTHER_PRINT	1
 #define JFFS3_DBG_SUBSYS_SCAN_PRINT	1
+#define JFFS3_DBG_SUBSYS_GC_PRINT	1
 #else
 #define JFFS3_DBG_SUBSYS_OTHER_PRINT	0
 #define JFFS3_DBG_SUBSYS_SCAN_PRINT	0
+#define JFFS3_DBG_SUBSYS_GC_PRINT	0
 #endif
 
 /*
@@ -42,6 +50,9 @@
 	char *subsysname = NULL;						\
 	if ((debug_level) >= CONFIG_JFFS3_FS_DEBUG) {				\
 		switch (subsystem) {						\
+			case JFFS3_DBG_GC:					\
+				if (JFFS3_DBG_SUBSYS_GC_PRINT)			\
+					subsysname = "GC";			\
 			case JFFS3_DBG_SCAN:					\
 				if (JFFS3_DBG_SUBSYS_SCAN_PRINT)		\
 					subsysname = "scan";			\
@@ -71,6 +82,9 @@
 #define DBG_SCAN(debug_level, args...)						\
 	JFFS3DBG_SUBSYSTEM(JFFS3_DBG_SCAN, debug_level, args)
 
+#define DBG_GC(debug_level, args...)						\
+	JFFS3DBG_SUBSYSTEM(JFFS3_DBG_GC, debug_level, args)
+
 #define ERROR_MSG(args...)							\
 	do {									\
 		printk(KERN_ERR "[JFFS3] Error in %s(): ", __FUNCTION__);	\
@@ -79,7 +93,7 @@
 
 #define WARNING_MSG(args...)							\
 	do {									\
-		printk(KERN_ERR "[JFFS3] Warning in %s(): ", __FUNCTION__);	\
+		printk(KERN_WARNING "[JFFS3] Warning in %s(): ", __FUNCTION__);	\
 		printk(args);							\
 	} while(0)
 
@@ -115,8 +129,8 @@
 static inline void
 jffs3_dbg_acct_sanity_check(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb)
 {
-	if (jeb && jeb->used_size + jeb->dirty_size + jeb->free_size
-				+ jeb->wasted_size + jeb->unchecked_size != c->sector_size) {
+	if (unlikely(jeb && jeb->used_size + jeb->dirty_size + jeb->free_size
+				+ jeb->wasted_size + jeb->unchecked_size != c->sector_size)) {
 		printk(KERN_ERR "Eeep. Space accounting for block at 0x%08x is screwed\n", jeb->offset);
 		printk(KERN_ERR "free %#08x + dirty %#08x + used %#08x + wasted %#08x + unchecked "
 				"%#08x != total %#08x\n", jeb->free_size, jeb->dirty_size, jeb->used_size,
@@ -124,8 +138,8 @@
 		BUG();
 	}
 	
-	if (c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size
-				+ c->wasted_size + c->unchecked_size != c->flash_size) {
+	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)) {
 		printk(KERN_ERR "Eeep. Space accounting superblock info is screwed\n");
 		printk(KERN_ERR "free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + "
 				"wasted %#08x + unchecked %#08x != total %#08x\n",





More information about the linux-mtd-cvs mailing list