提交 e0d60137 编写于 作者: A Artem B. Bityutskiy 提交者: Thomas Gleixner

[JFFS2] Debug code clean up - step 5

Replace the D1(printk()) style debugging with the new debug macros
Signed-off-by: NArtem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 f97117d1
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *
* $Id: nodelist.c,v 1.101 2005/07/27 14:46:11 dedekind Exp $ * $Id: nodelist.c,v 1.102 2005/07/28 12:45:10 dedekind Exp $
* *
*/ */
...@@ -24,35 +24,31 @@ ...@@ -24,35 +24,31 @@
void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list) void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list)
{ {
struct jffs2_full_dirent **prev = list; struct jffs2_full_dirent **prev = list;
D1(printk(KERN_DEBUG "jffs2_add_fd_to_list( %p, %p (->%p))\n", new, list, *list));
JFFS2_DBG_DENTLIST("add dirent \"%s\", ino #%u\n", new->name, new->ino);
while ((*prev) && (*prev)->nhash <= new->nhash) { while ((*prev) && (*prev)->nhash <= new->nhash) {
if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) { if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) {
/* Duplicate. Free one */ /* Duplicate. Free one */
if (new->version < (*prev)->version) { if (new->version < (*prev)->version) {
D1(printk(KERN_DEBUG "Eep! Marking new dirent node obsolete\n")); JFFS2_DBG_DENTLIST("Eep! Marking new dirent node is obsolete, old is \"%s\", ino #%u\n",
D1(printk(KERN_DEBUG "New dirent is \"%s\"->ino #%u. Old is \"%s\"->ino #%u\n", new->name, new->ino, (*prev)->name, (*prev)->ino)); (*prev)->name, (*prev)->ino);
jffs2_mark_node_obsolete(c, new->raw); jffs2_mark_node_obsolete(c, new->raw);
jffs2_free_full_dirent(new); jffs2_free_full_dirent(new);
} else { } else {
D1(printk(KERN_DEBUG "Marking old dirent node (ino #%u) obsolete\n", (*prev)->ino)); JFFS2_DBG_DENTLIST("marking old dirent \"%s\", ino #%u bsolete\n",
(*prev)->name, (*prev)->ino);
new->next = (*prev)->next; new->next = (*prev)->next;
jffs2_mark_node_obsolete(c, ((*prev)->raw)); jffs2_mark_node_obsolete(c, ((*prev)->raw));
jffs2_free_full_dirent(*prev); jffs2_free_full_dirent(*prev);
*prev = new; *prev = new;
} }
goto out; return;
} }
prev = &((*prev)->next); prev = &((*prev)->next);
} }
new->next = *prev; new->next = *prev;
*prev = new; *prev = new;
out:
D2(while(*list) {
printk(KERN_DEBUG "Dirent \"%s\" (hash 0x%08x, ino #%u\n", (*list)->name, (*list)->nhash, (*list)->ino);
list = &(*list)->next;
});
} }
void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this) void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this)
...@@ -61,14 +57,13 @@ void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *t ...@@ -61,14 +57,13 @@ void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *t
this->node->frags--; this->node->frags--;
if (!this->node->frags) { if (!this->node->frags) {
/* The node has no valid frags left. It's totally obsoleted */ /* The node has no valid frags left. It's totally obsoleted */
D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) obsolete\n", JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) obsolete\n",
ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size)); ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size);
jffs2_mark_node_obsolete(c, this->node->raw); jffs2_mark_node_obsolete(c, this->node->raw);
jffs2_free_full_dnode(this->node); jffs2_free_full_dnode(this->node);
} else { } else {
D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n", JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n",
ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size, ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size, this->node->frags);
this->node->frags));
mark_ref_normal(this->node->raw); mark_ref_normal(this->node->raw);
} }
...@@ -81,20 +76,19 @@ static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_ ...@@ -81,20 +76,19 @@ static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_
struct rb_node *parent = &base->rb; struct rb_node *parent = &base->rb;
struct rb_node **link = &parent; struct rb_node **link = &parent;
D2(printk(KERN_DEBUG "jffs2_fragtree_insert(%p; %d-%d, %p)\n", newfrag, JFFS2_DBG_FRAGTREE2("insert frag (0x%04x-0x%04x)\n", newfrag->ofs, newfrag->ofs + newfrag->size);
newfrag->ofs, newfrag->ofs+newfrag->size, base));
while (*link) { while (*link) {
parent = *link; parent = *link;
base = rb_entry(parent, struct jffs2_node_frag, rb); base = rb_entry(parent, struct jffs2_node_frag, rb);
D2(printk(KERN_DEBUG "fragtree_insert considering frag at 0x%x\n", base->ofs)); JFFS2_DBG_FRAGTREE2("considering frag at 0x%08x\n", base->ofs);
if (newfrag->ofs > base->ofs) if (newfrag->ofs > base->ofs)
link = &base->rb.rb_right; link = &base->rb.rb_right;
else if (newfrag->ofs < base->ofs) else if (newfrag->ofs < base->ofs)
link = &base->rb.rb_left; link = &base->rb.rb_left;
else { else {
printk(KERN_CRIT "Duplicate frag at %08x (%p,%p)\n", newfrag->ofs, newfrag, base); JFFS2_ERROR("duplicate frag at %08x (%p,%p)\n", newfrag->ofs, newfrag, base);
BUG(); BUG();
} }
} }
...@@ -112,11 +106,11 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l ...@@ -112,11 +106,11 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
this = jffs2_lookup_node_frag(list, newfrag->node->ofs); this = jffs2_lookup_node_frag(list, newfrag->node->ofs);
if (this) { if (this) {
D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n", JFFS2_DBG_FRAGTREE2("lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this)); this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this);
lastend = this->ofs + this->size; lastend = this->ofs + this->size;
} else { } else {
D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave no frag\n")); JFFS2_DBG_FRAGTREE2("lookup gave no frag\n");
lastend = 0; lastend = 0;
} }
...@@ -148,10 +142,10 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l ...@@ -148,10 +142,10 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
/* By definition, the 'this' node has no right-hand child, /* By definition, the 'this' node has no right-hand child,
because there are no frags with offset greater than it. because there are no frags with offset greater than it.
So that's where we want to put the hole */ So that's where we want to put the hole */
D2(printk(KERN_DEBUG "Adding hole frag (%p) on right of node at (%p)\n", holefrag, this)); JFFS2_DBG_FRAGTREE2("adding hole frag (%p) on right of node at (%p)\n", holefrag, this);
rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right); rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right);
} else { } else {
D2(printk(KERN_DEBUG "Adding hole frag (%p) at root of tree\n", holefrag)); JFFS2_DBG_FRAGTREE2("adding hole frag (%p) at root of tree\n", holefrag);
rb_link_node(&holefrag->rb, NULL, &list->rb_node); rb_link_node(&holefrag->rb, NULL, &list->rb_node);
} }
rb_insert_color(&holefrag->rb, list); rb_insert_color(&holefrag->rb, list);
...@@ -161,18 +155,18 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l ...@@ -161,18 +155,18 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
/* By definition, the 'this' node has no right-hand child, /* By definition, the 'this' node has no right-hand child,
because there are no frags with offset greater than it. because there are no frags with offset greater than it.
So that's where we want to put new fragment */ So that's where we want to put new fragment */
D2(printk(KERN_DEBUG "Adding new frag (%p) on right of node at (%p)\n", newfrag, this)); JFFS2_DBG_FRAGTREE2("adding new frag (%p) on right of node at (%p)\n", newfrag, this);
rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right); rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right);
} else { } else {
D2(printk(KERN_DEBUG "Adding new frag (%p) at root of tree\n", newfrag)); JFFS2_DBG_FRAGTREE2("adding new frag (%p) at root of tree\n", newfrag);
rb_link_node(&newfrag->rb, NULL, &list->rb_node); rb_link_node(&newfrag->rb, NULL, &list->rb_node);
} }
rb_insert_color(&newfrag->rb, list); rb_insert_color(&newfrag->rb, list);
return 0; return 0;
} }
D2(printk(KERN_DEBUG "j_a_f_d_t_f: dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n", JFFS2_DBG_FRAGTREE2("dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this)); this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this);
/* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes, /* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes,
* - i.e. newfrag->ofs < this->ofs+this->size && newfrag->ofs >= this->ofs * - i.e. newfrag->ofs < this->ofs+this->size && newfrag->ofs >= this->ofs
...@@ -193,12 +187,12 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l ...@@ -193,12 +187,12 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
jffs2_free_node_frag(newfrag); jffs2_free_node_frag(newfrag);
return -ENOMEM; return -ENOMEM;
} }
D2(printk(KERN_DEBUG "split old frag 0x%04x-0x%04x -->", this->ofs, this->ofs+this->size);
if (this->node) if (this->node)
printk("phys 0x%08x\n", ref_offset(this->node->raw)); JFFS2_DBG_FRAGTREE2("split old frag 0x%04x-0x%04x, phys 0x%08x\n",
this->ofs, this->ofs+this->size, ref_offset(this->node->raw));
else else
printk("hole\n"); JFFS2_DBG_FRAGTREE2("split old hole frag 0x%04x-0x%04x\n",
) this->ofs, this->ofs+this->size, ref_offset(this->node->raw));
/* New second frag pointing to this's node */ /* New second frag pointing to this's node */
newfrag2->ofs = newfrag->ofs + newfrag->size; newfrag2->ofs = newfrag->ofs + newfrag->size;
...@@ -233,14 +227,13 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l ...@@ -233,14 +227,13 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
} else { } else {
/* New frag starts at the same point as 'this' used to. Replace /* New frag starts at the same point as 'this' used to. Replace
it in the tree without doing a delete and insertion */ it in the tree without doing a delete and insertion */
D2(printk(KERN_DEBUG "Inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n", JFFS2_DBG_FRAGTREE2("inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
newfrag, newfrag->ofs, newfrag->ofs+newfrag->size, newfrag, newfrag->ofs, newfrag->ofs+newfrag->size, this, this->ofs, this->ofs+this->size);
this, this->ofs, this->ofs+this->size));
rb_replace_node(&this->rb, &newfrag->rb, list); rb_replace_node(&this->rb, &newfrag->rb, list);
if (newfrag->ofs + newfrag->size >= this->ofs+this->size) { if (newfrag->ofs + newfrag->size >= this->ofs+this->size) {
D2(printk(KERN_DEBUG "Obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size)); JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size);
jffs2_obsolete_node_frag(c, this); jffs2_obsolete_node_frag(c, this);
} else { } else {
this->ofs += newfrag->size; this->ofs += newfrag->size;
...@@ -256,7 +249,8 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l ...@@ -256,7 +249,8 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
*/ */
while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) { while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) {
/* 'this' frag is obsoleted completely. */ /* 'this' frag is obsoleted completely. */
D2(printk(KERN_DEBUG "Obsoleting node frag %p (%x-%x) and removing from tree\n", this, this->ofs, this->ofs+this->size)); JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x) and removing from tree\n",
this, this->ofs, this->ofs+this->size);
rb_erase(&this->rb, list); rb_erase(&this->rb, list);
jffs2_obsolete_node_frag(c, this); jffs2_obsolete_node_frag(c, this);
} }
...@@ -286,8 +280,6 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in ...@@ -286,8 +280,6 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in
int ret; int ret;
struct jffs2_node_frag *newfrag; struct jffs2_node_frag *newfrag;
D1(printk(KERN_DEBUG "jffs2_add_full_dnode_to_inode(ino #%u, f %p, fn %p)\n", f->inocache->ino, f, fn));
if (unlikely(!fn->size)) if (unlikely(!fn->size))
return 0; return 0;
...@@ -295,8 +287,8 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in ...@@ -295,8 +287,8 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in
if (unlikely(!newfrag)) if (unlikely(!newfrag))
return -ENOMEM; return -ENOMEM;
D2(printk(KERN_DEBUG "adding node %04x-%04x @0x%08x on flash, newfrag *%p\n", JFFS2_DBG_FRAGTREE("adding node %#04x-%#04x @0x%08x on flash, newfrag *%p\n",
fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag)); fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag);
newfrag->ofs = fn->ofs; newfrag->ofs = fn->ofs;
newfrag->size = fn->size; newfrag->size = fn->size;
...@@ -350,8 +342,6 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t ...@@ -350,8 +342,6 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t
{ {
struct jffs2_inode_cache *ret; struct jffs2_inode_cache *ret;
D2(printk(KERN_DEBUG "jffs2_get_ino_cache(): ino %u\n", ino));
ret = c->inocache_list[ino % INOCACHE_HASHSIZE]; ret = c->inocache_list[ino % INOCACHE_HASHSIZE];
while (ret && ret->ino < ino) { while (ret && ret->ino < ino) {
ret = ret->next; ret = ret->next;
...@@ -360,7 +350,6 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t ...@@ -360,7 +350,6 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t
if (ret && ret->ino != ino) if (ret && ret->ino != ino)
ret = NULL; ret = NULL;
D2(printk(KERN_DEBUG "jffs2_get_ino_cache found %p for ino %u\n", ret, ino));
return ret; return ret;
} }
...@@ -372,7 +361,7 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new ...@@ -372,7 +361,7 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new
if (!new->ino) if (!new->ino)
new->ino = ++c->highest_ino; new->ino = ++c->highest_ino;
D2(printk(KERN_DEBUG "jffs2_add_ino_cache: Add %p (ino #%u)\n", new, new->ino)); JFFS2_DBG_INOCACHE("add %p (ino #%u)\n", new, new->ino);
prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE]; prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE];
...@@ -388,7 +377,8 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new ...@@ -388,7 +377,8 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new
void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old)
{ {
struct jffs2_inode_cache **prev; struct jffs2_inode_cache **prev;
D1(printk(KERN_DEBUG "jffs2_del_ino_cache: Del %p (ino #%u)\n", old, old->ino));
JFFS2_DBG_INOCACHE("del %p (ino #%u)\n", old, old->ino);
spin_lock(&c->inocache_lock); spin_lock(&c->inocache_lock);
prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE]; prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE];
...@@ -451,29 +441,29 @@ struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_ ...@@ -451,29 +441,29 @@ struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_
struct jffs2_node_frag *prev = NULL; struct jffs2_node_frag *prev = NULL;
struct jffs2_node_frag *frag = NULL; struct jffs2_node_frag *frag = NULL;
D2(printk(KERN_DEBUG "jffs2_lookup_node_frag(%p, %d)\n", fragtree, offset)); JFFS2_DBG_FRAGTREE2("root %p, offset %d\n", fragtree, offset);
next = fragtree->rb_node; next = fragtree->rb_node;
while(next) { while(next) {
frag = rb_entry(next, struct jffs2_node_frag, rb); frag = rb_entry(next, struct jffs2_node_frag, rb);
D2(printk(KERN_DEBUG "Considering frag %d-%d (%p). left %p, right %p\n", JFFS2_DBG_FRAGTREE2("considering frag %#04x-%#04x (%p). left %p, right %p\n",
frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right)); frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right);
if (frag->ofs + frag->size <= offset) { if (frag->ofs + frag->size <= offset) {
D2(printk(KERN_DEBUG "Going right from frag %d-%d, before the region we care about\n", JFFS2_DBG_FRAGTREE2("going right from frag %#04x-%#04x, before the region we care about\n",
frag->ofs, frag->ofs+frag->size)); frag->ofs, frag->ofs+frag->size);
/* Remember the closest smaller match on the way down */ /* Remember the closest smaller match on the way down */
if (!prev || frag->ofs > prev->ofs) if (!prev || frag->ofs > prev->ofs)
prev = frag; prev = frag;
next = frag->rb.rb_right; next = frag->rb.rb_right;
} else if (frag->ofs > offset) { } else if (frag->ofs > offset) {
D2(printk(KERN_DEBUG "Going left from frag %d-%d, after the region we care about\n", JFFS2_DBG_FRAGTREE2("going left from frag %#04x-%#04x, after the region we care about\n",
frag->ofs, frag->ofs+frag->size)); frag->ofs, frag->ofs+frag->size);
next = frag->rb.rb_left; next = frag->rb.rb_left;
} else { } else {
D2(printk(KERN_DEBUG "Returning frag %d,%d, matched\n", JFFS2_DBG_FRAGTREE2("returning frag %#04x-%#04x, matched\n",
frag->ofs, frag->ofs+frag->size)); frag->ofs, frag->ofs+frag->size);
return frag; return frag;
} }
} }
...@@ -482,10 +472,10 @@ struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_ ...@@ -482,10 +472,10 @@ struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_
and return the closest smaller one */ and return the closest smaller one */
if (prev) if (prev)
D2(printk(KERN_DEBUG "No match. Returning frag %d,%d, closest previous\n", JFFS2_DBG_FRAGTREE2("no match. Returning frag %#04x-%#04x, closest previous\n",
prev->ofs, prev->ofs+prev->size)); prev->ofs, prev->ofs+prev->size);
else else
D2(printk(KERN_DEBUG "Returning NULL, empty fragtree\n")); JFFS2_DBG_FRAGTREE2("returning NULL, empty fragtree\n");
return prev; return prev;
} }
...@@ -500,25 +490,25 @@ void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c) ...@@ -500,25 +490,25 @@ void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c)
if (!root->rb_node) if (!root->rb_node)
return; return;
frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb)); JFFS2_DBG_FRAGTREE("killing\n");
frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb));
while(frag) { while(frag) {
if (frag->rb.rb_left) { if (frag->rb.rb_left) {
D2(printk(KERN_DEBUG "Going left from frag (%p) %d-%d\n", JFFS2_DBG_FRAGTREE2("going left from frag (%p) %#04x-%#04x\n",
frag, frag->ofs, frag->ofs+frag->size)); frag, frag->ofs, frag->ofs+frag->size);
frag = frag_left(frag); frag = frag_left(frag);
continue; continue;
} }
if (frag->rb.rb_right) { if (frag->rb.rb_right) {
D2(printk(KERN_DEBUG "Going right from frag (%p) %d-%d\n", JFFS2_DBG_FRAGTREE2("going right from frag (%p) %#04x-%#04x\n",
frag, frag->ofs, frag->ofs+frag->size)); frag, frag->ofs, frag->ofs+frag->size);
frag = frag_right(frag); frag = frag_right(frag);
continue; continue;
} }
D2(printk(KERN_DEBUG "jffs2_kill_fragtree: frag at 0x%x-0x%x: node %p, frags %d--\n", JFFS2_DBG_FRAGTREE2("frag %#04x-%#04x: node %p, frags %d\n",
frag->ofs, frag->ofs+frag->size, frag->node, frag->ofs, frag->ofs+frag->size, frag->node, frag->node?frag->node->frags:0);
frag->node?frag->node->frags:0));
if (frag->node && !(--frag->node->frags)) { if (frag->node && !(--frag->node->frags)) {
/* Not a hole, and it's the final remaining frag /* Not a hole, and it's the final remaining frag
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册