mtd/fs/jffs2 readinode.c,1.82,1.83

David Woodhouse dwmw2 at infradead.org
Tue Sep 3 18:29:31 EDT 2002


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

Modified Files:
	readinode.c 
Log Message:
Some sanity checks in print_frag_list

Index: readinode.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/readinode.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- readinode.c	3 Sep 2002 21:55:52 -0000	1.82
+++ readinode.c	3 Sep 2002 22:29:29 -0000	1.83
@@ -23,13 +23,22 @@
 D1(static void jffs2_print_fragtree(rb_root_t *list)
 {
 	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 on flash (*%p). left (%p), right (%p), parent (%p)\n", this->ofs, this->ofs+this->size, this->node->raw->flash_offset &~3, 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) {
+		printk(KERN_CRIT "Frag tree got a hole in it\n");
+		BUG();
 	}
 })
 D1(void jffs2_print_frag_list(struct jffs2_inode_info *f)





More information about the linux-mtd-cvs mailing list