mtd/fs/jffs2 nodelist.c,1.58,1.59 readinode.c,1.86,1.87
David Woodhouse
dwmw2 at infradead.org
Tue Sep 3 20:09:06 EDT 2002
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv3050
Modified Files:
nodelist.c readinode.c
Log Message:
Reduce debugging. It seems to be working
Index: nodelist.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- nodelist.c 3 Sep 2002 23:43:16 -0000 1.58
+++ nodelist.c 4 Sep 2002 00:09:03 -0000 1.59
@@ -380,28 +380,28 @@
struct jffs2_node_frag *prev = NULL;
struct jffs2_node_frag *frag = NULL;
- D1(printk(KERN_DEBUG "jffs2_lookup_node_frag(%p, %d)\n", fragtree, offset));
+ D2(printk(KERN_DEBUG "jffs2_lookup_node_frag(%p, %d)\n", fragtree, offset));
next = fragtree->rb_node;
while(next) {
frag = rb_entry(next, struct jffs2_node_frag, rb);
- D1(printk(KERN_DEBUG "Considering frag %d-%d (%p). left %p, right %p\n",
+ D2(printk(KERN_DEBUG "Considering frag %d-%d (%p). left %p, right %p\n",
frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right));
if (frag->ofs + frag->size <= offset) {
- D1(printk(KERN_DEBUG "Going right from frag %d-%d, before the region we care about\n",
+ D2(printk(KERN_DEBUG "Going right from frag %d-%d, before the region we care about\n",
frag->ofs, frag->ofs+frag->size));
/* Remember the closest smaller match on the way down */
if (!prev || frag->ofs > prev->ofs)
prev = frag;
next = frag->rb.rb_right;
} else if (frag->ofs > offset) {
- D1(printk(KERN_DEBUG "Going left from frag %d-%d, after the region we care about\n",
+ D2(printk(KERN_DEBUG "Going left from frag %d-%d, after the region we care about\n",
frag->ofs, frag->ofs+frag->size));
next = frag->rb.rb_left;
} else {
- D1(printk(KERN_DEBUG "Returning frag %d,%d, matched\n",
+ D2(printk(KERN_DEBUG "Returning frag %d,%d, matched\n",
frag->ofs, frag->ofs+frag->size));
return frag;
}
@@ -411,27 +411,12 @@
and return the closest smaller one */
if (prev)
- D1(printk(KERN_DEBUG "No match. Returning frag %d,%d, closest previous\n",
+ D2(printk(KERN_DEBUG "No match. Returning frag %d,%d, closest previous\n",
prev->ofs, prev->ofs+prev->size));
else
- D1(printk(KERN_DEBUG "Returning NULL, empty fragtree\n"));
+ D2(printk(KERN_DEBUG "Returning NULL, empty fragtree\n"));
return prev;
-#if 0
- ret = frag;
-
- while (frag) {
- D1(printk(KERN_DEBUG "Considering frag %d-%d (%p) as closest previous.\n",
- frag->ofs, frag->ofs+frag->size, frag));
- if (frag->ofs < offset && frag->ofs > ret->ofs)
- ret = frag;
-
- frag = frag_parent(frag);
- }
-
-
- return ret;
-#endif
}
/* Pass 'c' argument to indicate that nodes should be marked obsolete as
@@ -448,19 +433,19 @@
while(frag) {
if (frag->rb.rb_left) {
- D1(printk(KERN_DEBUG "Going left from frag (%p) %d-%d\n",
+ D2(printk(KERN_DEBUG "Going left from frag (%p) %d-%d\n",
frag, frag->ofs, frag->ofs+frag->size));
frag = frag_left(frag);
continue;
}
if (frag->rb.rb_right) {
- D1(printk(KERN_DEBUG "Going right from frag (%p) %d-%d\n",
+ D2(printk(KERN_DEBUG "Going right from frag (%p) %d-%d\n",
frag, frag->ofs, frag->ofs+frag->size));
frag = frag_right(frag);
continue;
}
- D1(printk(KERN_DEBUG "jffs2_kill_fragtree: frag at 0x%x-0x%x: node %p, frags %d--\n",
+ D2(printk(KERN_DEBUG "jffs2_kill_fragtree: frag at 0x%x-0x%x: node %p, frags %d--\n",
frag->ofs, frag->ofs+frag->size, frag->node,
frag->node?frag->node->frags:0));
@@ -490,14 +475,14 @@
rb_node_t *parent = &base->rb;
rb_node_t **link = &parent;
- D1(printk(KERN_DEBUG "jffs2_fragtree_insert(%p; %d-%d, %p)\n", newfrag,
+ D2(printk(KERN_DEBUG "jffs2_fragtree_insert(%p; %d-%d, %p)\n", newfrag,
newfrag->ofs, newfrag->ofs+newfrag->size, base));
while (*link) {
parent = *link;
base = rb_entry(parent, struct jffs2_node_frag, rb);
- D1(printk(KERN_DEBUG "fragtree_insert considering frag at 0x%x\n", base->ofs));
+ D2(printk(KERN_DEBUG "fragtree_insert considering frag at 0x%x\n", base->ofs));
if (newfrag->ofs > base->ofs)
link = &base->rb.rb_right;
else if (newfrag->ofs < base->ofs)
@@ -542,13 +527,8 @@
if (parent) {
if (victim == parent->rb_left)
parent->rb_left = new;
- else if (victim == parent->rb_right)
+ else
parent->rb_right = new;
- else {
- printk(KERN_CRIT "Parent disowned us. %p, %p, %p, %p\n",
- victim, parent, parent->rb_left, parent->rb_right);
- BUG();
- }
} else {
root->rb_node = new;
}
Index: readinode.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/readinode.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- readinode.c 3 Sep 2002 23:43:17 -0000 1.86
+++ readinode.c 4 Sep 2002 00:09:03 -0000 1.87
@@ -41,6 +41,7 @@
BUG();
}
})
+
D1(void jffs2_print_frag_list(struct jffs2_inode_info *f)
{
jffs2_print_fragtree(&f->fragtree, 0);
@@ -116,11 +117,11 @@
this = jffs2_lookup_node_frag(list, fn->ofs);
if (this) {
- D1(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
+ D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
this->ofs, this->ofs+this->size, this->node?(this->node->raw->flash_offset &~3):0xffffffff, this));
lastend = this->ofs + this->size;
} else {
- D1(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave no frag\n"));
+ D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave no frag\n"));
lastend = 0;
}
@@ -139,10 +140,10 @@
/* By definition, the 'this' node has no right-hand child,
because there are no frags with offset greater than it.
So that's where we want to put the hole */
- D1(printk(KERN_DEBUG "Adding hole frag (%p) on right of node at (%p)\n", holefrag, this));
+ D2(printk(KERN_DEBUG "Adding hole frag (%p) on right of node at (%p)\n", holefrag, this));
rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right);
} else {
- D1(printk(KERN_DEBUG "Adding hole frag (%p) at root of tree\n", holefrag));
+ D2(printk(KERN_DEBUG "Adding hole frag (%p) at root of tree\n", holefrag));
rb_link_node(&holefrag->rb, NULL, &list->rb_node);
}
rb_insert_color(&holefrag->rb, list);
@@ -152,17 +153,17 @@
/* By definition, the 'this' node has no right-hand child,
because there are no frags with offset greater than it.
So that's where we want to put the hole */
- D1(printk(KERN_DEBUG "Adding new frag (%p) on right of node at (%p)\n", newfrag, this));
+ D2(printk(KERN_DEBUG "Adding new frag (%p) on right of node at (%p)\n", newfrag, this));
rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right);
} else {
- D1(printk(KERN_DEBUG "Adding new frag (%p) at root of tree\n", newfrag));
+ D2(printk(KERN_DEBUG "Adding new frag (%p) at root of tree\n", newfrag));
rb_link_node(&newfrag->rb, NULL, &list->rb_node);
}
rb_insert_color(&newfrag->rb, list);
return 0;
}
- D1(printk(KERN_DEBUG "j_a_f_d_t_f: dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
+ D2(printk(KERN_DEBUG "j_a_f_d_t_f: dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
this->ofs, this->ofs+this->size, this->node?(this->node->raw->flash_offset &~3):0xffffffff, this));
/* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes,
@@ -177,7 +178,7 @@
jffs2_free_node_frag(newfrag);
return -ENOMEM;
}
- D1(printk(KERN_DEBUG "split old frag 0x%04x-0x%04x -->", this->ofs, this->ofs+this->size);
+ D2(printk(KERN_DEBUG "split old frag 0x%04x-0x%04x -->", this->ofs, this->ofs+this->size);
if (this->node)
printk("phys 0x%08x\n", this->node->raw->flash_offset &~3);
else
@@ -217,25 +218,20 @@
} else {
/* New frag starts at the same point as 'this' used to. Replace
it in the tree without doing a delete and insertion */
- D1(printk(KERN_DEBUG "Inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
+ D2(printk(KERN_DEBUG "Inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
newfrag, newfrag->ofs, newfrag->ofs+newfrag->size,
this, this->ofs, this->ofs+this->size));
rb_replace_node(&this->rb, &newfrag->rb, list);
- printk("After rb_replace_node:\n");
- jffs2_print_fragtree(list, 1);
-
+
if (newfrag->ofs + newfrag->size >= this->ofs+this->size) {
- D1(printk("Obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size));
+ D2(printk("Obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size));
jffs2_obsolete_node_frag(c, this);
} else {
this->ofs += newfrag->size;
this->size -= newfrag->size;
- printk("before inserting new shrunk frag %d-%d:\n", this->ofs, this->ofs+this->size);
- jffs2_print_fragtree(list, 1);
+
jffs2_fragtree_insert(this, newfrag);
- printk("inserted:\n");
- jffs2_print_fragtree(list, 1);
rb_insert_color(&this->rb, list);
return 0;
}
@@ -245,7 +241,7 @@
*/
while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) {
/* 'this' frag is obsoleted completely. */
- D1(printk("Obsoleting node frag %p (%x-%x) and removing from tree\n", this, this->ofs, this->ofs+this->size));
+ D2(printk("Obsoleting node frag %p (%x-%x) and removing from tree\n", this, this->ofs, this->ofs+this->size));
rb_erase(&this->rb, list);
jffs2_obsolete_node_frag(c, this);
}
More information about the linux-mtd-cvs
mailing list