mtd/fs/jffs2 debug.c, NONE, 1.1 debug.h, NONE, 1.1 Makefile.common,
1.9, 1.10 build.c, 1.71, 1.72 erase.c, 1.80, 1.81 fs.c, 1.56,
1.57 gc.c, 1.148, 1.149 nodelist.h, 1.131, 1.132 nodemgmt.c,
1.122, 1.123 read.c, 1.39, 1.40 readinode.c, 1.125,
1.126 scan.c, 1.119, 1.120 wbuf.c, 1.92, 1.93 write.c, 1.92, 1.93
Artem Bityuckiy
dedekind at infradead.org
Sun Jul 17 02:56:26 EDT 2005
- Previous message: mtd/scripts patchin.xml,1.5,1.6
- Next message: mtd/fs/jffs2 dir.c, 1.86, 1.87 os-linux.h, 1.58, 1.59 readinode.c,
1.126, 1.127 symlink-v24.c, 1.17, 1.18 symlink.c, 1.16, 1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv21572
Modified Files:
Makefile.common build.c erase.c fs.c gc.c nodelist.h
nodemgmt.c read.c readinode.c scan.c wbuf.c write.c
Added Files:
debug.c debug.h
Log Message:
[JFFS2] Cleanup the debugging stuff
Move most of debugging-related JFFS2 stuff to debug.c and debug.h. It is much
tidier then the previous approach. Preserve dwmw2's favourite D1() - I would
like to clean-up them as well, but do not dare. :-)
***** Error reading new file: [Errno 2] No such file or directory: 'debug.c'
***** Error reading new file: [Errno 2] No such file or directory: 'debug.h'
Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/Makefile.common,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Makefile.common 9 Feb 2005 09:23:53 -0000 1.9
+++ Makefile.common 17 Jul 2005 06:56:20 -0000 1.10
@@ -9,7 +9,7 @@
jffs2-y := compr.o dir.o file.o ioctl.o nodelist.o malloc.o
jffs2-y += read.o nodemgmt.o readinode.o write.o scan.o gc.o
jffs2-y += symlink.o build.o erase.o background.o fs.o writev.o
-jffs2-y += super.o
+jffs2-y += super.o debug.o
jffs2-$(CONFIG_JFFS2_FS_WRITEBUFFER) += wbuf.o
jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rubin.o
Index: build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- build.c 12 Jul 2005 16:37:08 -0000 1.71
+++ build.c 17 Jul 2005 06:56:20 -0000 1.72
@@ -104,7 +104,7 @@
goto exit;
D1(printk(KERN_DEBUG "Scanned flash completely\n"));
- D2(jffs2_dump_block_lists(c));
+ D2(jffs2_dbg_dump_block_lists(c));
c->flags |= JFFS2_SB_FLAG_BUILDING;
/* Now scan the directory tree, increasing nlink according to every dirent found. */
@@ -168,7 +168,7 @@
c->flags &= ~JFFS2_SB_FLAG_BUILDING;
D1(printk(KERN_DEBUG "Pass 3 complete\n"));
- D2(jffs2_dump_block_lists(c));
+ D2(jffs2_dbg_dump_block_lists(c));
/* Rotate the lists by some number to ensure wear levelling */
jffs2_rotate_lists(c);
Index: erase.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/erase.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- erase.c 14 Jul 2005 19:46:24 -0000 1.80
+++ erase.c 17 Jul 2005 06:56:20 -0000 1.81
@@ -429,8 +429,8 @@
c->free_size += jeb->free_size;
c->used_size += jeb->used_size;
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
list_add_tail(&jeb->list, &c->free_list);
c->nr_erasing_blocks--;
Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- fs.c 6 Jul 2005 12:13:09 -0000 1.56
+++ fs.c 17 Jul 2005 06:56:21 -0000 1.57
@@ -203,7 +203,7 @@
buf->f_bavail = buf->f_bfree = avail >> PAGE_SHIFT;
- D2(jffs2_dump_block_lists(c));
+ D2(jffs2_dbg_dump_block_lists(c));
spin_unlock(&c->erase_completion_lock);
Index: gc.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/gc.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -r1.148 -r1.149
--- gc.c 9 Apr 2005 10:47:00 -0000 1.148
+++ gc.c 17 Jul 2005 06:56:21 -0000 1.149
@@ -111,7 +111,7 @@
ret->wasted_size = 0;
}
- D2(jffs2_dump_block_lists(c));
+ D2(jffs2_dbg_dump_block_lists(c));
return ret;
}
@@ -142,7 +142,7 @@
if (c->checked_ino > c->highest_ino) {
printk(KERN_CRIT "Checked all inodes but still 0x%x bytes of unchecked space?\n",
c->unchecked_size);
- D2(jffs2_dump_block_lists(c));
+ D2(jffs2_dbg_dump_block_lists(c));
spin_unlock(&c->erase_completion_lock);
BUG();
}
@@ -619,16 +619,16 @@
D1(printk(KERN_DEBUG "Retrying failed write of REF_PRISTINE node.\n"));
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
ret = jffs2_reserve_space_gc(c, rawlen, &phys_ofs, &dummy);
if (!ret) {
D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", phys_ofs));
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
Index: nodelist.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.h,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- nodelist.h 5 Jul 2005 21:03:07 -0000 1.131
+++ nodelist.h 17 Jul 2005 06:56:21 -0000 1.132
@@ -24,26 +24,10 @@
#ifdef __ECOS
#include "os-ecos.h"
#else
-#include <linux/mtd/compatmac.h> /* For min/max in older kernels */
+#include <linux/mtd/compatmac.h> /* For compatibility with older kernels */
#include "os-linux.h"
#endif
-#ifndef CONFIG_JFFS2_FS_DEBUG
-#define CONFIG_JFFS2_FS_DEBUG 1
-#endif
-
-#if CONFIG_JFFS2_FS_DEBUG > 0
-#define D1(x) x
-#else
-#define D1(x)
-#endif
-
-#if CONFIG_JFFS2_FS_DEBUG > 1
-#define D2(x) x
-#else
-#define D2(x)
-#endif
-
#define JFFS2_NATIVE_ENDIAN
/* Note we handle mode bits conversion from JFFS2 (i.e. Linux) to/from
@@ -207,79 +191,6 @@
struct jffs2_raw_node_ref *gc_node; /* Next node to be garbage collected */
};
-#define ACCT_SANITY_CHECK(c, jeb) do { \
- struct jffs2_eraseblock *___j = jeb; \
- if ((___j) && ___j->used_size + ___j->dirty_size + ___j->free_size + ___j->wasted_size + ___j->unchecked_size != c->sector_size) { \
- printk(KERN_NOTICE "Eeep. Space accounting for block at 0x%08x is screwed\n", ___j->offset); \
- printk(KERN_NOTICE "free 0x%08x + dirty 0x%08x + used %08x + wasted %08x + unchecked %08x != total %08x\n", \
- ___j->free_size, ___j->dirty_size, ___j->used_size, ___j->wasted_size, ___j->unchecked_size, c->sector_size); \
- 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) { \
- printk(KERN_NOTICE "Eeep. Space accounting superblock info is screwed\n"); \
- printk(KERN_NOTICE "free 0x%08x + dirty 0x%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(); \
- } \
-} while(0)
-
-static inline void paranoia_failed_dump(struct jffs2_eraseblock *jeb)
-{
- struct jffs2_raw_node_ref *ref;
- int i=0;
-
- printk(KERN_NOTICE);
- for (ref = jeb->first_node; ref; ref = ref->next_phys) {
- printk("%08x->", ref_offset(ref));
- if (++i == 8) {
- i = 0;
- printk("\n" KERN_NOTICE);
- }
- }
- printk("\n");
-}
-
-
-#define ACCT_PARANOIA_CHECK(jeb) do { \
- uint32_t my_used_size = 0; \
- uint32_t my_unchecked_size = 0; \
- struct jffs2_raw_node_ref *ref2 = jeb->first_node; \
- while (ref2) { \
- if (unlikely(ref2->flash_offset < jeb->offset || \
- ref2->flash_offset > jeb->offset + c->sector_size)) { \
- printk(KERN_NOTICE "Node %08x shouldn't be in block at %08x!\n", \
- ref_offset(ref2), jeb->offset); \
- paranoia_failed_dump(jeb); \
- BUG(); \
- } \
- if (ref_flags(ref2) == REF_UNCHECKED) \
- my_unchecked_size += ref_totlen(c, jeb, ref2); \
- else if (!ref_obsolete(ref2)) \
- my_used_size += ref_totlen(c, jeb, ref2); \
- if (unlikely((!ref2->next_phys) != (ref2 == jeb->last_node))) { \
- if (!ref2->next_phys) \
- printk("ref for node at %p (phys %08x) has next_phys->%p (----), last_node->%p (phys %08x)\n", \
- ref2, ref_offset(ref2), ref2->next_phys, \
- jeb->last_node, ref_offset(jeb->last_node)); \
- else \
- printk("ref for node at %p (phys %08x) has next_phys->%p (%08x), last_node->%p (phys %08x)\n", \
- ref2, ref_offset(ref2), ref2->next_phys, ref_offset(ref2->next_phys), \
- jeb->last_node, ref_offset(jeb->last_node)); \
- paranoia_failed_dump(jeb); \
- BUG(); \
- } \
- ref2 = ref2->next_phys; \
- } \
- if (my_used_size != jeb->used_size) { \
- printk(KERN_NOTICE "Calculated used size %08x != stored used size %08x\n", my_used_size, jeb->used_size); \
- BUG(); \
- } \
- if (my_unchecked_size != jeb->unchecked_size) { \
- printk(KERN_NOTICE "Calculated unchecked size %08x != stored unchecked size %08x\n", my_unchecked_size, jeb->unchecked_size); \
- BUG(); \
- } \
- } while(0)
-
/* Calculate totlen from surrounding nodes or eraseblock */
static inline uint32_t __ref_totlen(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb,
@@ -306,11 +217,13 @@
{
uint32_t ret;
- D1(if (jeb && jeb != &c->blocks[ref->flash_offset / c->sector_size]) {
+#if CONFIG_JFFS2_FS_DEBUG > 0
+ if (jeb && jeb != &c->blocks[ref->flash_offset / c->sector_size]) {
printk(KERN_CRIT "ref_totlen called with wrong block -- at 0x%08x instead of 0x%08x; ref 0x%08x\n",
jeb->offset, c->blocks[ref->flash_offset / c->sector_size].offset, ref_offset(ref));
BUG();
- })
+ }
+#endif
#if 1
ret = ref->__totlen;
@@ -323,14 +236,13 @@
ret, ref->__totlen);
if (!jeb)
jeb = &c->blocks[ref->flash_offset / c->sector_size];
- paranoia_failed_dump(jeb);
+ jffs2_dbg_dump_node_refs(c, jeb);
BUG();
}
#endif
return ret;
}
-
#define ALLOC_NORMAL 0 /* Normal allocation */
#define ALLOC_DELETION 1 /* Deletion node. Best to allow it */
#define ALLOC_GC 2 /* Space requested for GC. Give it or die */
@@ -384,7 +296,6 @@
#define frag_erase(frag, list) rb_erase(&frag->rb, list);
/* nodelist.c */
-D2(void jffs2_print_frag_list(struct jffs2_inode_info *f));
void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list);
int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
struct rb_root *tnp, struct jffs2_full_dirent **fdp,
@@ -410,7 +321,6 @@
int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new);
void jffs2_complete_reservation(struct jffs2_sb_info *c);
void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *raw);
-void jffs2_dump_block_lists(struct jffs2_sb_info *c);
/* write.c */
int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri);
@@ -483,4 +393,6 @@
int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
#endif
+#include "debug.h"
+
#endif /* __JFFS2_NODELIST_H__ */
Index: nodemgmt.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodemgmt.c,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -r1.122 -r1.123
--- nodemgmt.c 6 May 2005 09:30:27 -0000 1.122
+++ nodemgmt.c 17 Jul 2005 06:56:21 -0000 1.123
@@ -349,8 +349,8 @@
list_add_tail(&jeb->list, &c->clean_list);
c->nextblock = NULL;
}
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
spin_unlock(&c->erase_completion_lock);
@@ -466,9 +466,9 @@
}
ref->flash_offset = ref_offset(ref) | REF_OBSOLETE;
- ACCT_SANITY_CHECK(c, jeb);
+ jffs2_dbg_acct_sanity_check(c, jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_paranoia_check(c, jeb);
if (c->flags & JFFS2_SB_FLAG_SCANNING) {
/* Flash scanning is in progress. Don't muck about with the block
@@ -649,164 +649,6 @@
up(&c->erase_free_sem);
}
-#if CONFIG_JFFS2_FS_DEBUG >= 2
-void jffs2_dump_block_lists(struct jffs2_sb_info *c)
-{
-
-
- printk(KERN_DEBUG "jffs2_dump_block_lists:\n");
- printk(KERN_DEBUG "flash_size: %08x\n", c->flash_size);
- printk(KERN_DEBUG "used_size: %08x\n", c->used_size);
- printk(KERN_DEBUG "dirty_size: %08x\n", c->dirty_size);
- printk(KERN_DEBUG "wasted_size: %08x\n", c->wasted_size);
- printk(KERN_DEBUG "unchecked_size: %08x\n", c->unchecked_size);
- printk(KERN_DEBUG "free_size: %08x\n", c->free_size);
- printk(KERN_DEBUG "erasing_size: %08x\n", c->erasing_size);
- printk(KERN_DEBUG "bad_size: %08x\n", c->bad_size);
- printk(KERN_DEBUG "sector_size: %08x\n", c->sector_size);
- printk(KERN_DEBUG "jffs2_reserved_blocks size: %08x\n",c->sector_size * c->resv_blocks_write);
-
- if (c->nextblock) {
- printk(KERN_DEBUG "nextblock: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->unchecked_size, c->nextblock->free_size);
- } else {
- printk(KERN_DEBUG "nextblock: NULL\n");
- }
- if (c->gcblock) {
- printk(KERN_DEBUG "gcblock: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- c->gcblock->offset, c->gcblock->used_size, c->gcblock->dirty_size, c->gcblock->wasted_size, c->gcblock->unchecked_size, c->gcblock->free_size);
- } else {
- printk(KERN_DEBUG "gcblock: NULL\n");
- }
- if (list_empty(&c->clean_list)) {
- printk(KERN_DEBUG "clean_list: empty\n");
- } else {
- struct list_head *this;
- int numblocks = 0;
- uint32_t dirty = 0;
-
- list_for_each(this, &c->clean_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- numblocks ++;
- dirty += jeb->wasted_size;
- printk(KERN_DEBUG "clean_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n", jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- printk (KERN_DEBUG "Contains %d blocks with total wasted size %u, average wasted size: %u\n", numblocks, dirty, dirty / numblocks);
- }
- if (list_empty(&c->very_dirty_list)) {
- printk(KERN_DEBUG "very_dirty_list: empty\n");
- } else {
- struct list_head *this;
- int numblocks = 0;
- uint32_t dirty = 0;
-
- list_for_each(this, &c->very_dirty_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- numblocks ++;
- dirty += jeb->dirty_size;
- printk(KERN_DEBUG "very_dirty_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- printk (KERN_DEBUG "Contains %d blocks with total dirty size %u, average dirty size: %u\n",
- numblocks, dirty, dirty / numblocks);
- }
- if (list_empty(&c->dirty_list)) {
- printk(KERN_DEBUG "dirty_list: empty\n");
- } else {
- struct list_head *this;
- int numblocks = 0;
- uint32_t dirty = 0;
-
- list_for_each(this, &c->dirty_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- numblocks ++;
- dirty += jeb->dirty_size;
- printk(KERN_DEBUG "dirty_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- printk (KERN_DEBUG "Contains %d blocks with total dirty size %u, average dirty size: %u\n",
- numblocks, dirty, dirty / numblocks);
- }
- if (list_empty(&c->erasable_list)) {
- printk(KERN_DEBUG "erasable_list: empty\n");
- } else {
- struct list_head *this;
-
- list_for_each(this, &c->erasable_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- printk(KERN_DEBUG "erasable_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- }
- if (list_empty(&c->erasing_list)) {
- printk(KERN_DEBUG "erasing_list: empty\n");
- } else {
- struct list_head *this;
-
- list_for_each(this, &c->erasing_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- printk(KERN_DEBUG "erasing_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- }
- if (list_empty(&c->erase_pending_list)) {
- printk(KERN_DEBUG "erase_pending_list: empty\n");
- } else {
- struct list_head *this;
-
- list_for_each(this, &c->erase_pending_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- printk(KERN_DEBUG "erase_pending_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- }
- if (list_empty(&c->erasable_pending_wbuf_list)) {
- printk(KERN_DEBUG "erasable_pending_wbuf_list: empty\n");
- } else {
- struct list_head *this;
-
- list_for_each(this, &c->erasable_pending_wbuf_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- printk(KERN_DEBUG "erasable_pending_wbuf_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- }
- if (list_empty(&c->free_list)) {
- printk(KERN_DEBUG "free_list: empty\n");
- } else {
- struct list_head *this;
-
- list_for_each(this, &c->free_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- printk(KERN_DEBUG "free_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- }
- if (list_empty(&c->bad_list)) {
- printk(KERN_DEBUG "bad_list: empty\n");
- } else {
- struct list_head *this;
-
- list_for_each(this, &c->bad_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- printk(KERN_DEBUG "bad_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- }
- if (list_empty(&c->bad_used_list)) {
- printk(KERN_DEBUG "bad_used_list: empty\n");
- } else {
- struct list_head *this;
-
- list_for_each(this, &c->bad_used_list) {
- struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list);
- printk(KERN_DEBUG "bad_used_list: %08x (used %08x, dirty %08x, wasted %08x, unchecked %08x, free %08x)\n",
- jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, jeb->unchecked_size, jeb->free_size);
- }
- }
-}
-#endif /* CONFIG_JFFS2_FS_DEBUG */
-
int jffs2_thread_should_wake(struct jffs2_sb_info *c)
{
int ret = 0;
Index: read.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/read.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- read.c 1 Mar 2005 10:34:03 -0000 1.39
+++ read.c 17 Jul 2005 06:56:21 -0000 1.40
@@ -174,7 +174,7 @@
if (frag) {
D1(printk(KERN_NOTICE "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(jffs2_print_frag_list(f));
+ D2(jffs2_dbg_dump_fragtree(f));
}
D1(printk(KERN_DEBUG "Filling non-frag hole from %d-%d\n", offset, offset+holesize));
memset(buf, 0, holesize);
Index: readinode.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/readinode.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- readinode.c 10 Jul 2005 13:13:55 -0000 1.125
+++ readinode.c 17 Jul 2005 06:56:21 -0000 1.126
@@ -22,104 +22,6 @@
static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *list, struct jffs2_node_frag *newfrag);
-#if CONFIG_JFFS2_FS_DEBUG >= 2
-static void jffs2_print_fragtree(struct rb_root *list, int permitbug)
-{
- struct jffs2_node_frag *this = frag_first(list);
- uint32_t lastofs = 0;
- int buggy = 0;
-
- while(this) {
- if (this->node)
- printk(KERN_DEBUG "frag %04x-%04x: 0x%08x(%d) on flash (*%p). left (%p), right (%p), parent (%p)\n",
- this->ofs, this->ofs+this->size, ref_offset(this->node->raw), ref_flags(this->node->raw),
- this, frag_left(this), frag_right(this), frag_parent(this));
- else
- printk(KERN_DEBUG "frag %04x-%04x: hole (*%p). left (%p} right (%p), parent (%p)\n", this->ofs,
- this->ofs+this->size, this, frag_left(this), frag_right(this), frag_parent(this));
- if (this->ofs != lastofs)
- buggy = 1;
- lastofs = this->ofs+this->size;
- this = frag_next(this);
- }
- if (buggy && !permitbug) {
- printk(KERN_CRIT "Frag tree got a hole in it\n");
- BUG();
- }
-}
-
-void jffs2_print_frag_list(struct jffs2_inode_info *f)
-{
- jffs2_print_fragtree(&f->fragtree, 0);
-
- if (f->metadata) {
- printk(KERN_DEBUG "metadata at 0x%08x\n", ref_offset(f->metadata->raw));
- }
-}
-#endif
-
-#if CONFIG_JFFS2_FS_DEBUG >= 1
-static int jffs2_sanitycheck_fragtree(struct jffs2_inode_info *f)
-{
- struct jffs2_node_frag *frag;
- int bitched = 0;
-
- for (frag = frag_first(&f->fragtree); frag; frag = frag_next(frag)) {
-
- struct jffs2_full_dnode *fn = frag->node;
- if (!fn || !fn->raw)
- continue;
-
- if (ref_flags(fn->raw) == REF_PRISTINE) {
-
- if (fn->frags > 1) {
- printk(KERN_WARNING "REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2\n", ref_offset(fn->raw), fn->frags);
- bitched = 1;
- }
- /* A hole node which isn't multi-page should be garbage-collected
- and merged anyway, so we just check for the frag size here,
- rather than mucking around with actually reading the node
- and checking the compression type, which is the real way
- to tell a hole node. */
- if (frag->ofs & (PAGE_CACHE_SIZE-1) && frag_prev(frag) && frag_prev(frag)->size < PAGE_CACHE_SIZE && frag_prev(frag)->node) {
- printk(KERN_WARNING "REF_PRISTINE node at 0x%08x had a previous non-hole frag in the same page. Tell dwmw2\n",
- ref_offset(fn->raw));
- bitched = 1;
- }
-
- if ((frag->ofs+frag->size) & (PAGE_CACHE_SIZE-1) && frag_next(frag) && frag_next(frag)->size < PAGE_CACHE_SIZE && frag_next(frag)->node) {
- printk(KERN_WARNING "REF_PRISTINE node at 0x%08x (%08x-%08x) had a following non-hole frag in the same page. Tell dwmw2\n",
- ref_offset(fn->raw), frag->ofs, frag->ofs+frag->size);
- bitched = 1;
- }
- }
- }
-
- if (bitched) {
- struct jffs2_node_frag *thisfrag;
-
- printk(KERN_WARNING "Inode is #%u\n", f->inocache->ino);
- thisfrag = frag_first(&f->fragtree);
- while (thisfrag) {
- if (!thisfrag->node) {
- printk("Frag @0x%x-0x%x; node-less hole\n",
- thisfrag->ofs, thisfrag->size + thisfrag->ofs);
- } else if (!thisfrag->node->raw) {
- printk("Frag @0x%x-0x%x; raw-less hole\n",
- thisfrag->ofs, thisfrag->size + thisfrag->ofs);
- } else {
- printk("Frag @0x%x-0x%x; raw at 0x%08x(%d) (0x%x-0x%x)\n",
- thisfrag->ofs, thisfrag->size + thisfrag->ofs,
- ref_offset(thisfrag->node->raw), ref_flags(thisfrag->node->raw),
- thisfrag->node->ofs, thisfrag->node->ofs+thisfrag->node->size);
- }
- thisfrag = frag_next(thisfrag);
- }
- }
- return bitched;
-}
-#endif /* D1 */
-
static void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this)
{
if (this->node) {
@@ -190,12 +92,8 @@
mark_ref_normal(next->node->raw);
}
}
- D2(if (jffs2_sanitycheck_fragtree(f)) {
- printk(KERN_WARNING "Just added node %04x-%04x @0x%08x on flash, newfrag *%p\n",
- fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag);
- return 0;
- })
- D2(jffs2_print_frag_list(f));
+ D2(jffs2_dbg_fragtree_paranoia_check(f));
+ D2(jffs2_dbg_dump_fragtree(f));
return 0;
}
@@ -582,7 +480,7 @@
jffs2_free_tmp_dnode_info(tn);
}
- D1(jffs2_sanitycheck_fragtree(f));
+ jffs2_dbg_fragtree_paranoia_check(f);
if (!fn) {
/* No data nodes for this inode. */
Index: scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/scan.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- scan.c 17 Feb 2005 17:51:13 -0000 1.119
+++ scan.c 17 Jul 2005 06:56:21 -0000 1.120
@@ -130,7 +130,7 @@
if (ret < 0)
goto out;
- ACCT_PARANOIA_CHECK(jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
/* Now decide which list to put it on */
switch(ret) {
@@ -370,7 +370,7 @@
scan_more:
while(ofs < jeb->offset + c->sector_size) {
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_paranoia_check(c, jeb);
cond_resched();
Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- wbuf.c 5 Apr 2005 12:51:54 -0000 1.92
+++ wbuf.c 17 Jul 2005 06:56:21 -0000 1.93
@@ -137,7 +137,7 @@
{
D1(printk("About to refile bad block at %08x\n", jeb->offset));
- D2(jffs2_dump_block_lists(c));
+ D2(jffs2_dbg_dump_block_lists(c));
/* File the existing block on the bad_used_list.... */
if (c->nextblock == jeb)
c->nextblock = NULL;
@@ -154,7 +154,7 @@
c->nr_erasing_blocks++;
jffs2_erase_pending_trigger(c);
}
- D2(jffs2_dump_block_lists(c));
+ D2(jffs2_dbg_dump_block_lists(c));
/* Adjust its size counts accordingly */
c->wasted_size += jeb->free_size;
@@ -162,8 +162,8 @@
jeb->wasted_size += jeb->free_size;
jeb->free_size = 0;
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
}
/* Recover from failure to write wbuf. Recover the nodes up to the
@@ -390,11 +390,11 @@
else
jeb->last_node = container_of(first_raw, struct jffs2_raw_node_ref, next_phys);
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
- ACCT_SANITY_CHECK(c,new_jeb);
- D1(ACCT_PARANOIA_CHECK(new_jeb));
+ jffs2_dbg_acct_sanity_check(c,new_jeb);
+ jffs2_dbg_acct_paranoia_check(c, new_jeb);
spin_unlock(&c->erase_completion_lock);
@@ -971,7 +971,7 @@
if (buf[i] != 0xFF) {
D2(printk(KERN_DEBUG "Found %02x at %x in OOB for %08x\n",
- buf[page+i], page+i, jeb->offset));
+ buf[i], i, jeb->offset));
ret = 1;
goto out;
}
Index: write.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/write.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- write.c 13 Apr 2005 13:22:35 -0000 1.92
+++ write.c 17 Jul 2005 06:56:21 -0000 1.93
@@ -54,34 +54,6 @@
return 0;
}
-#if CONFIG_JFFS2_FS_DEBUG > 0
-static void writecheck(struct jffs2_sb_info *c, uint32_t ofs)
-{
- unsigned char buf[16];
- size_t retlen;
- int ret, i;
-
- ret = jffs2_flash_read(c, ofs, 16, &retlen, buf);
- if (ret || (retlen != 16)) {
- D1(printk(KERN_DEBUG "read failed or short in writecheck(). ret %d, retlen %zd\n", ret, retlen));
- return;
- }
- ret = 0;
- for (i=0; i<16; i++) {
- if (buf[i] != 0xff)
- ret = 1;
- }
- if (ret) {
- printk(KERN_WARNING "ARGH. About to write node to 0x%08x on flash, but there are data already there:\n", ofs);
- printk(KERN_WARNING "0x%08x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
- ofs,
- buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7],
- buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]);
- }
-}
-#endif
-
-
/* jffs2_write_dnode - given a raw_inode, allocate a full_dnode for it,
write it to the flash, link it into the existing inode/fragment list */
@@ -106,7 +78,7 @@
vecs[1].iov_base = (unsigned char *)data;
vecs[1].iov_len = datalen;
- D1(writecheck(c, flash_ofs));
+ jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen);
@@ -177,8 +149,8 @@
D1(printk(KERN_DEBUG "Retrying failed write.\n"));
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
if (alloc_mode == ALLOC_GC) {
ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &flash_ofs, &dummy);
@@ -194,8 +166,8 @@
if (!ret) {
D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs));
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
@@ -232,7 +204,7 @@
je32_to_cpu(ri->data_crc), je32_to_cpu(ri->totlen)));
if (retried) {
- ACCT_SANITY_CHECK(c,NULL);
+ jffs2_dbg_acct_sanity_check(c,NULL);
}
return fn;
@@ -250,7 +222,8 @@
D1(printk(KERN_DEBUG "jffs2_write_dirent(ino #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x)\n",
je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
je32_to_cpu(rd->name_crc)));
- D1(writecheck(c, flash_ofs));
+
+ jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) {
printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dirent()\n");
@@ -322,8 +295,8 @@
D1(printk(KERN_DEBUG "Retrying failed write.\n"));
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
if (alloc_mode == ALLOC_GC) {
ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &flash_ofs, &dummy);
@@ -338,8 +311,8 @@
if (!ret) {
D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs));
- ACCT_SANITY_CHECK(c,jeb);
- D1(ACCT_PARANOIA_CHECK(jeb));
+ jffs2_dbg_acct_sanity_check(c,jeb);
+ jffs2_dbg_acct_paranoia_check(c, jeb);
goto retry;
}
D1(printk(KERN_DEBUG "Failed to allocate space to retry failed write: %d!\n", ret));
@@ -359,7 +332,7 @@
spin_unlock(&c->erase_completion_lock);
if (retried) {
- ACCT_SANITY_CHECK(c,NULL);
+ jffs2_dbg_acct_sanity_check(c,NULL);
}
return fd;
- Previous message: mtd/scripts patchin.xml,1.5,1.6
- Next message: mtd/fs/jffs2 dir.c, 1.86, 1.87 os-linux.h, 1.58, 1.59 readinode.c,
1.126, 1.127 symlink-v24.c, 1.17, 1.18 symlink.c, 1.16, 1.17
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the linux-mtd-cvs
mailing list