Commit e0c8e42f authored by Artem B. Bityutskiy's avatar Artem B. Bityutskiy Committed by Thomas Gleixner

[JFFS2] Debug code clean up - step 3

Various simplifiactions. printk format corrections.
Convert more code to use the new debug functions.
Signed-off-by: default avatarArtem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 6dac02a5
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: build.c,v 1.74 2005/07/17 12:01:42 dedekind Exp $
* $Id: build.c,v 1.75 2005/07/22 10:32:07 dedekind Exp $
*
*/
......@@ -104,7 +104,7 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
goto exit;
D1(printk(KERN_DEBUG "Scanned flash completely\n"));
D2(jffs2_dbg_dump_block_lists(c));
jffs2_dbg_dump_block_lists_nolock(c);
c->flags |= JFFS2_SB_FLAG_BUILDING;
/* Now scan the directory tree, increasing nlink according to every dirent found. */
......@@ -168,7 +168,7 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
c->flags &= ~JFFS2_SB_FLAG_BUILDING;
D1(printk(KERN_DEBUG "Pass 3 complete\n"));
jffs2_dbg_dump_block_lists(c);
jffs2_dbg_dump_block_lists_nolock(c);
/* Rotate the lists by some number to ensure wear levelling */
jffs2_rotate_lists(c);
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: erase.c,v 1.81 2005/07/17 06:56:20 dedekind Exp $
* $Id: erase.c,v 1.83 2005/07/22 10:32:08 dedekind Exp $
*
*/
......@@ -48,7 +48,8 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
#else /* Linux */
struct erase_info *instr;
D1(printk(KERN_DEBUG "jffs2_erase_block(): erase block %#x (range %#x-%#x)\n", jeb->offset, jeb->offset, jeb->offset + c->sector_size));
D1(printk(KERN_DEBUG "jffs2_erase_block(): erase block %#08x (range %#08x-%#08x)\n",
jeb->offset, jeb->offset, jeb->offset + c->sector_size));
instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL);
if (!instr) {
printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");
......@@ -429,8 +430,8 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
c->free_size += jeb->free_size;
c->used_size += jeb->used_size;
jffs2_dbg_acct_sanity_check(c,jeb);
jffs2_dbg_acct_paranoia_check(c, jeb);
jffs2_dbg_acct_sanity_check_nolock(c,jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
list_add_tail(&jeb->list, &c->free_list);
c->nr_erasing_blocks--;
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: fs.c,v 1.59 2005/07/18 11:21:19 dedekind Exp $
* $Id: fs.c,v 1.60 2005/07/22 10:32:08 dedekind Exp $
*
*/
......@@ -194,19 +194,15 @@ int jffs2_statfs(struct super_block *sb, struct kstatfs *buf)
buf->f_namelen = JFFS2_MAX_NAME_LEN;
spin_lock(&c->erase_completion_lock);
avail = c->dirty_size + c->free_size;
if (avail > c->sector_size * c->resv_blocks_write)
avail -= c->sector_size * c->resv_blocks_write;
else
avail = 0;
spin_unlock(&c->erase_completion_lock);
buf->f_bavail = buf->f_bfree = avail >> PAGE_SHIFT;
jffs2_dbg_dump_block_lists(c);
spin_unlock(&c->erase_completion_lock);
return 0;
}
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: gc.c,v 1.150 2005/07/17 12:01:43 dedekind Exp $
* $Id: gc.c,v 1.152 2005/07/24 15:14:14 dedekind Exp $
*
*/
......@@ -111,7 +111,6 @@ again:
ret->wasted_size = 0;
}
jffs2_dbg_dump_block_lists(c);
return ret;
}
......@@ -142,7 +141,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
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);
jffs2_dbg_dump_block_lists(c);
jffs2_dbg_dump_block_lists_nolock(c);
spin_unlock(&c->erase_completion_lock);
BUG();
}
......@@ -485,7 +484,8 @@ static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_era
if (ref_obsolete(raw)) {
printk(KERN_WARNING "But it's obsolete so we don't mind too much\n");
} else {
ret = -EIO;
jffs2_dbg_dump_node(c, ref_offset(raw));
BUG();
}
}
upnout:
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: nodelist.c,v 1.99 2005/07/15 10:13:54 dedekind Exp $
* $Id: nodelist.c,v 1.100 2005/07/22 10:32:08 dedekind Exp $
*
*/
......@@ -203,7 +203,7 @@ read_direntry(struct jffs2_sb_info *c,
return -EIO;
if (unlikely(err)) {
printk(KERN_WARNING "Read remainder of name in jffs2_get_inode_nodes(): error %d\n", err);
printk(KERN_WARNING "Read remainder of name: error %d\n", err);
jffs2_free_full_dirent(fd);
return -EIO;
}
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: nodelist.h,v 1.132 2005/07/17 06:56:21 dedekind Exp $
* $Id: nodelist.h,v 1.133 2005/07/22 10:32:08 dedekind Exp $
*
*/
......@@ -236,7 +236,7 @@ static inline uint32_t ref_totlen(struct jffs2_sb_info *c,
ret, ref->__totlen);
if (!jeb)
jeb = &c->blocks[ref->flash_offset / c->sector_size];
jffs2_dbg_dump_node_refs(c, jeb);
jffs2_dbg_dump_node_refs_nolock(c, jeb);
BUG();
}
#endif
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: nodemgmt.c,v 1.123 2005/07/17 06:56:21 dedekind Exp $
* $Id: nodemgmt.c,v 1.124 2005/07/20 15:32:28 dedekind Exp $
*
*/
......@@ -349,8 +349,8 @@ int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_r
list_add_tail(&jeb->list, &c->clean_list);
c->nextblock = NULL;
}
jffs2_dbg_acct_sanity_check(c,jeb);
jffs2_dbg_acct_paranoia_check(c, jeb);
jffs2_dbg_acct_sanity_check_nolock(c,jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
spin_unlock(&c->erase_completion_lock);
......@@ -430,7 +430,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
ref_totlen(c, jeb, ref), blocknr, ref->flash_offset, jeb->used_size);
BUG();
})
D1(printk(KERN_DEBUG "Obsoleting node at 0x%08x of len %x: ", ref_offset(ref), ref_totlen(c, jeb, ref)));
D1(printk(KERN_DEBUG "Obsoleting node at 0x%08x of len %#x: ", ref_offset(ref), ref_totlen(c, jeb, ref)));
jeb->used_size -= ref_totlen(c, jeb, ref);
c->used_size -= ref_totlen(c, jeb, ref);
}
......@@ -466,9 +466,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
}
ref->flash_offset = ref_offset(ref) | REF_OBSOLETE;
jffs2_dbg_acct_sanity_check(c, jeb);
jffs2_dbg_acct_paranoia_check(c, jeb);
jffs2_dbg_acct_sanity_check_nolock(c, jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
if (c->flags & JFFS2_SB_FLAG_SCANNING) {
/* Flash scanning is in progress. Don't muck about with the block
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: read.c,v 1.40 2005/07/17 06:56:21 dedekind Exp $
* $Id: read.c,v 1.41 2005/07/22 10:32:08 dedekind Exp $
*
*/
......@@ -174,7 +174,6 @@ int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
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_dbg_dump_fragtree(f));
}
D1(printk(KERN_DEBUG "Filling non-frag hole from %d-%d\n", offset, offset+holesize));
memset(buf, 0, holesize);
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: readinode.c,v 1.128 2005/07/17 12:01:43 dedekind Exp $
* $Id: readinode.c,v 1.129 2005/07/22 10:32:08 dedekind Exp $
*
*/
......@@ -92,8 +92,8 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in
mark_ref_normal(next->node->raw);
}
}
jffs2_dbg_fragtree_paranoia_check(f);
jffs2_dbg_dump_fragtree(f);
jffs2_dbg_fragtree_paranoia_check_nolock(f);
jffs2_dbg_dump_fragtree_nolock(f);
return 0;
}
......@@ -480,7 +480,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
jffs2_free_tmp_dnode_info(tn);
}
jffs2_dbg_fragtree_paranoia_check(f);
jffs2_dbg_fragtree_paranoia_check_nolock(f);
if (!fn) {
/* No data nodes for this inode. */
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: scan.c,v 1.120 2005/07/17 06:56:21 dedekind Exp $
* $Id: scan.c,v 1.121 2005/07/20 15:32:28 dedekind Exp $
*
*/
#include <linux/kernel.h>
......@@ -130,7 +130,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
if (ret < 0)
goto out;
jffs2_dbg_acct_paranoia_check(c, jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
/* Now decide which list to put it on */
switch(ret) {
......@@ -370,7 +370,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
scan_more:
while(ofs < jeb->offset + c->sector_size) {
jffs2_dbg_acct_paranoia_check(c, jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
cond_resched();
......
......@@ -9,7 +9,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: wbuf.c,v 1.94 2005/07/17 12:01:43 dedekind Exp $
* $Id: wbuf.c,v 1.96 2005/07/22 10:32:08 dedekind Exp $
*
*/
......@@ -139,7 +139,6 @@ static void jffs2_block_refile(struct jffs2_sb_info *c, struct jffs2_eraseblock
{
D1(printk("About to refile bad block at %08x\n", jeb->offset));
jffs2_dbg_dump_block_lists(c);
/* File the existing block on the bad_used_list.... */
if (c->nextblock == jeb)
c->nextblock = NULL;
......@@ -156,7 +155,6 @@ static void jffs2_block_refile(struct jffs2_sb_info *c, struct jffs2_eraseblock
c->nr_erasing_blocks++;
jffs2_erase_pending_trigger(c);
}
jffs2_dbg_dump_block_lists(c);
/* Adjust its size counts accordingly */
c->wasted_size += jeb->free_size;
......@@ -164,8 +162,9 @@ static void jffs2_block_refile(struct jffs2_sb_info *c, struct jffs2_eraseblock
jeb->wasted_size += jeb->free_size;
jeb->free_size = 0;
jffs2_dbg_acct_sanity_check(c,jeb);
jffs2_dbg_acct_paranoia_check(c, jeb);
jffs2_dbg_dump_block_lists_nolock(c);
jffs2_dbg_acct_sanity_check_nolock(c,jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
}
/* Recover from failure to write wbuf. Recover the nodes up to the
......@@ -392,11 +391,11 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
else
jeb->last_node = container_of(first_raw, struct jffs2_raw_node_ref, next_phys);
jffs2_dbg_acct_sanity_check(c,jeb);
jffs2_dbg_acct_paranoia_check(c, jeb);
jffs2_dbg_acct_sanity_check_nolock(c, jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
jffs2_dbg_acct_sanity_check(c,new_jeb);
jffs2_dbg_acct_paranoia_check(c, new_jeb);
jffs2_dbg_acct_sanity_check_nolock(c, new_jeb);
jffs2_dbg_acct_paranoia_check_nolock(c, new_jeb);
spin_unlock(&c->erase_completion_lock);
......
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: write.c,v 1.93 2005/07/17 06:56:21 dedekind Exp $
* $Id: write.c,v 1.94 2005/07/20 15:50:51 dedekind Exp $
*
*/
......@@ -223,8 +223,6 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
je32_to_cpu(rd->name_crc)));
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");
BUG();
......@@ -236,6 +234,8 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
vecs[1].iov_base = (unsigned char *)name;
vecs[1].iov_len = namelen;
jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len);
raw = jffs2_alloc_raw_node_ref();
if (!raw)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment