mtd/fs/jffs3 debug.c, 1.4, 1.5 debug.h, 1.15, 1.16 fs.c, 3.4,
3.5 gc.c, 3.7, 3.8 nodemgmt.c, 3.4, 3.5 read.c, 3.3,
3.4 readinode.c, 3.3, 3.4 scan.c, 3.5, 3.6 wbuf.c, 3.5,
3.6 write.c, 3.5, 3.6
Artem Bityuckiy
dedekind at infradead.org
Wed Dec 22 13:35:55 EST 2004
Update of /home/cvs/mtd/fs/jffs3
In directory phoenix.infradead.org:/tmp/cvs-serv31685
Modified Files:
debug.c debug.h fs.c gc.c nodemgmt.c read.c readinode.c scan.c
wbuf.c write.c
Log Message:
Introduce DEBUG1, DEBUG2 macros. Use them instead D1() D2() style.
Introduce PARANOIA macro. Use it to decide if to call paranoid check.
Useful if want to have paranoid checks enabled but messages disabled.
Index: debug.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- debug.c 21 Dec 2004 17:12:56 -0000 1.4
+++ debug.c 22 Dec 2004 18:35:51 -0000 1.5
@@ -16,7 +16,7 @@
#include "nodelist.h"
#include "debug.h"
-#ifdef JFFS3_DBG_PARANOIA_CHECKS
+#if PARANOIA > 0
#define JFFS3_DBG_BUF_SIZE 4096
static unsigned char dbg_buf[JFFS3_DBG_BUF_SIZE];
@@ -215,25 +215,11 @@
BUG();
}
}
-#else
-void
-jffs3_dbg_acct_paranoia_check(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb)
-{
-}
-
-void
-jffs3_dbg_prewrite_paranoia_check(struct jffs3_sb_info *c, uint32_t ofs, int len)
-{
-}
-void
-jffs3_dbg_fragtree_paranoia_check(struct jffs3_inode_info *f)
-{
-}
-#endif /* JFFS3_DBG_PARANOIA_CHECKS */
+#endif /* PARANOIA > 0 */
+#if DEBUG1 > 0
-#if CONFIG_JFFS3_FS_DEBUG > 0
void
jffs3_dbg_dump_block_lists(struct jffs3_sb_info *c)
{
@@ -472,5 +458,4 @@
}
}
-#endif /* CONFIG_JFFS3_FS_DEBUG > 1 */
-
+#endif /* DEBUG1 > 0*/
Index: debug.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/debug.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- debug.h 22 Dec 2004 15:18:30 -0000 1.15
+++ debug.h 22 Dec 2004 18:35:51 -0000 1.16
@@ -16,12 +16,26 @@
#include <linux/kernel.h>
#include "jffs3.h"
+#if CONFIG_JFFS3_FS_DEBUG > 0
+#define DEBUG1 1
+#define PARANOIA 1
+#else
+#define DEBUG1 0
+#define PARANOIA 0
+#endif
+
+#if CONFIG_JFFS3_FS_DEBUG > 1
+#define DEBUG2 1
+#else
+#define DEBUG2 0
+#endif
+
/*
* 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
+#define SANITY 1
/*
* JFFS3 subsystems. Used in messaging to distinguish debugging messages
@@ -56,7 +70,6 @@
#define JFFS3_DBG_WRITE 18 /* JFFS2 nodes creation and writing */
#if CONFIG_JFFS3_FS_DEBUG > 0
-#define JFFS3_DBG_PARANOIA_CHECKS 1
/* By default print the debugging messages from almost all JFFS3 subsystems */
#define JFFS3_DBG_SUBSYS_OTHER_PRINT 1
#define JFFS3_DBG_SUBSYS_SCAN_PRINT 1
@@ -274,11 +287,10 @@
*/
#define NOTICE_MSG(args...) \
do { \
- printk(KERN_NOTICE "[JFFS3]: "); \
+ printk(KERN_NOTICE "[JFFS3] "); \
printk(args); \
} while(0)
-
void
jffs3_dbg_acct_paranoia_check(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb);
@@ -288,7 +300,6 @@
void
jffs3_dbg_fragtree_paranoia_check(struct jffs3_inode_info *f);
-#if CONFIG_JFFS3_FS_DEBUG > 0
void
jffs3_dbg_dump_block_lists(struct jffs3_sb_info *c);
@@ -297,10 +308,8 @@
void
jffs3_dbg_dump_buffer(char *buf, int len, uint32_t offs);
-#endif
-#ifdef JFFS3_DBG_SANITY_CHECKS
/*
* Check the space accounting of the file system and of the JFFS3 erasable block 'jeb'.
*/
@@ -342,17 +351,4 @@
}
}
-#else
-
-static inline void
-jffs3_dbg_acct_sanity_check(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb)
-{
-}
-
-jffs3_dbg_wbuf_acct_sanity_check(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb)
-{
-}
-
-#endif /* JFFS3_DBG_SANITY_CHECKS */
-
#endif /* __JFFS3_DEBUG_H__ */
Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/fs.c,v
retrieving revision 3.4
retrieving revision 3.5
diff -u -r3.4 -r3.5
--- fs.c 21 Dec 2004 15:18:50 -0000 3.4
+++ fs.c 22 Dec 2004 18:35:51 -0000 3.5
@@ -206,7 +206,8 @@
buf->f_bavail = buf->f_bfree = avail >> PAGE_SHIFT;
- D2(jffs3_dbg_dump_block_lists(c));
+ if (DEBUG2)
+ jffs3_dbg_dump_block_lists(c);
spin_unlock(&c->erase_completion_lock);
Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/gc.c,v
retrieving revision 3.7
retrieving revision 3.8
diff -u -r3.7 -r3.8
--- gc.c 21 Dec 2004 15:18:50 -0000 3.7
+++ gc.c 22 Dec 2004 18:35:51 -0000 3.8
@@ -104,7 +104,8 @@
ret->wasted_size = 0;
}
- D2(jffs3_dbg_dump_block_lists(c));
+ if (DEBUG2)
+ jffs3_dbg_dump_block_lists(c);
return ret;
}
@@ -135,7 +136,8 @@
if (c->checked_ino > c->highest_ino) {
ERROR_MSG("Checked all inodes but still 0x%x bytes of unchecked space?\n",
c->unchecked_size);
- D2(jffs3_dbg_dump_block_lists(c));
+ if (DEBUG2)
+ jffs3_dbg_dump_block_lists(c);
spin_unlock(&c->erase_completion_lock);
BUG();
}
@@ -616,7 +618,8 @@
DBG_GC(1, "Retrying failed write of REF_PRISTINE node.\n");
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
ret = jffs3_reserve_space_gc(c, rawlen, &phys_ofs, &dummy, rawlen); /* this is not optimal yet */
@@ -624,7 +627,8 @@
DBG_GC(1, "Allocated space at %#08x to retry failed write.\n", phys_ofs);
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
Index: nodemgmt.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/nodemgmt.c,v
retrieving revision 3.4
retrieving revision 3.5
diff -u -r3.4 -r3.5
--- nodemgmt.c 21 Dec 2004 17:12:56 -0000 3.4
+++ nodemgmt.c 22 Dec 2004 18:35:51 -0000 3.5
@@ -429,7 +429,8 @@
c->nextblock = NULL;
}
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
spin_unlock(&c->erase_completion_lock);
@@ -551,7 +552,8 @@
ref->flash_offset = ref_offset(ref) | REF_OBSOLETE;
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
if (c->flags & JFFS3_SB_FLAG_MOUNTING) {
/* Mount in progress. Don't muck about with the block
Index: read.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/read.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -r3.3 -r3.4
--- read.c 17 Dec 2004 18:50:29 -0000 3.3
+++ read.c 22 Dec 2004 18:35:51 -0000 3.4
@@ -174,7 +174,8 @@
WARNING_MSG("Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n",
f->inocache->ino, frag->ofs, offset);
holesize = min(holesize, frag->ofs - offset);
- D2(jffs3_dbg_print_frag_list(f));
+ if (DEBUG2)
+ jffs3_dbg_print_frag_list(f);
}
DBG_READ(1, "Filling non-frag hole from %d-%d\n", offset, offset+holesize);
memset(buf, 0, holesize);
Index: readinode.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/readinode.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -r3.3 -r3.4
--- readinode.c 22 Dec 2004 15:18:30 -0000 3.3
+++ readinode.c 22 Dec 2004 18:35:51 -0000 3.4
@@ -96,7 +96,8 @@
}
}
- D2(jffs3_dbg_print_frag_list(f));
+ if (DEBUG2)
+ jffs3_dbg_print_frag_list(f);
return 0;
}
@@ -466,7 +467,8 @@
jffs3_free_tmp_dnode_info(tn);
}
- jffs3_dbg_fragtree_paranoia_check(f);
+ if (PARANOIA)
+ jffs3_dbg_fragtree_paranoia_check(f);
if (!fn) {
/* No data nodes for this inode. */
Index: scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/scan.c,v
retrieving revision 3.5
retrieving revision 3.6
diff -u -r3.5 -r3.6
--- scan.c 21 Dec 2004 15:18:51 -0000 3.5
+++ scan.c 22 Dec 2004 18:35:51 -0000 3.6
@@ -103,7 +103,8 @@
if (ret < 0)
goto out;
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
/* Now decide which list to put it on */
switch(ret) {
@@ -401,7 +402,8 @@
scan_more:
while(ofs < jeb->offset + c->sector_size) {
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
cond_resched();
Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/wbuf.c,v
retrieving revision 3.5
retrieving revision 3.6
diff -u -r3.5 -r3.6
--- wbuf.c 21 Dec 2004 15:18:51 -0000 3.5
+++ wbuf.c 22 Dec 2004 18:35:51 -0000 3.6
@@ -135,7 +135,8 @@
{
DBG_WBUF(1, "About to refile bad block at %08x\n", jeb->offset);
- D2(jffs3_dbg_dump_block_lists(c));
+ if (DEBUG2)
+ jffs3_dbg_dump_block_lists(c);
/* File the existing block on the bad_used_list.... */
if (c->nextblock == jeb)
c->nextblock = NULL;
@@ -152,7 +153,8 @@
c->nr_erasing_blocks++;
jffs3_erase_pending_trigger(c);
}
- D2(jffs3_dbg_dump_block_lists(c));
+ if (DEBUG2)
+ jffs3_dbg_dump_block_lists(c);
/* Adjust its size counts accordingly */
c->wasted_size += jeb->free_size;
@@ -161,7 +163,8 @@
jeb->free_size = 0;
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
}
/* Recover from failure to write wbuf. Recover the nodes up to the
@@ -388,9 +391,11 @@
jeb->last_node = container_of(first_raw, struct jffs3_raw_node_ref, next_phys);
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
jffs3_dbg_acct_sanity_check(c, new_jeb);
- jffs3_dbg_acct_paranoia_check(c, new_jeb);
+ if (PARANOIA) {
+ jffs3_dbg_acct_paranoia_check(c, jeb);
+ jffs3_dbg_acct_paranoia_check(c, new_jeb);
+ }
spin_unlock(&c->erase_completion_lock);
@@ -1017,7 +1022,8 @@
if (retval == 1) {
DBG_WBUF(1, "Cleanmarker node not detected in block at %08x\n", jeb->offset);
DBG_WBUF(1, "OOB at %08x was ", offset);
- D1(jffs3_dbg_dump_buffer(buf, oob_size, 0));
+ if (PARANOIA)
+ jffs3_dbg_dump_buffer(buf, oob_size, 0);
}
}
offset += c->mtd->erasesize;
Index: write.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/write.c,v
retrieving revision 3.5
retrieving revision 3.6
diff -u -r3.5 -r3.6
--- write.c 22 Dec 2004 15:18:30 -0000 3.5
+++ write.c 22 Dec 2004 18:35:52 -0000 3.6
@@ -78,7 +78,8 @@
vecs[1].iov_base = (unsigned char *)data;
vecs[1].iov_len = datalen;
- jffs3_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
+ if (PARANOIA)
+ jffs3_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
WARNING_MSG("ri->totlen (0x%08x) != sizeof(*ri) "
@@ -144,7 +145,8 @@
DBG_WRITE(1, "Retrying failed write.\n");
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
if (alloc_mode == ALLOC_GC) {
ret = jffs3_reserve_space_gc(c, sizeof(*ri) + datalen, &flash_ofs, &dummy, JFFS3_SUMMARY_INODE_SIZE);
@@ -161,7 +163,8 @@
DBG_WRITE(1, "Allocated space at 0x%08x to retry failed write.\n", flash_ofs);
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
@@ -227,7 +230,8 @@
vecs[0].iov_len = sizeof(*rd);
vecs[1].iov_base = (unsigned char *)name;
vecs[1].iov_len = namelen;
- jffs3_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
+ if (PARANOIA)
+ jffs3_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
raw = jffs3_alloc_raw_node_ref();
@@ -280,7 +284,8 @@
DBG_WRITE(1, "Retrying failed write.\n");
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
if (alloc_mode == ALLOC_GC) {
ret = jffs3_reserve_space_gc(c, sizeof(*rd) + namelen, &flash_ofs, &dummy, JFFS3_SUMMARY_DIRENT_SIZE(namelen));
@@ -296,7 +301,8 @@
if (!ret) {
DBG_WRITE(1, "Allocated space at 0x%08x to retry failed write.\n", flash_ofs);
jffs3_dbg_acct_sanity_check(c, jeb);
- jffs3_dbg_acct_paranoia_check(c, jeb);
+ if (PARANOIA)
+ jffs3_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
DBG_WRITE(1, "Failed to allocate space to retry failed write: %d!\n", ret);
More information about the linux-mtd-cvs
mailing list