aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodelist.c
diff options
context:
space:
mode:
authorArtem B. Bityutskiy <dedekind@infradead.org>2005-07-28 10:46:43 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 12:01:24 -0500
commite0d601373b1123ea43b1fdec08d9e58a079ae35c (patch)
treed3def6c56255fb3b2b98edbfdb522fa84e6741ca /fs/jffs2/nodelist.c
parentf97117d15361b3a6aeaf9e347a287ef3f54b58f9 (diff)
[JFFS2] Debug code clean up - step 5
Replace the D1(printk()) style debugging with the new debug macros Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/nodelist.c')
-rw-r--r--fs/jffs2/nodelist.c126
1 files changed, 58 insertions, 68 deletions
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 8373d312b195..7997f526c94b 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodelist.c,v 1.101 2005/07/27 14:46:11 dedekind Exp $ 10 * $Id: nodelist.c,v 1.102 2005/07/28 12:45:10 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -24,35 +24,31 @@
24void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list) 24void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list)
25{ 25{
26 struct jffs2_full_dirent **prev = list; 26 struct jffs2_full_dirent **prev = list;
27 D1(printk(KERN_DEBUG "jffs2_add_fd_to_list( %p, %p (->%p))\n", new, list, *list)); 27
28 JFFS2_DBG_DENTLIST("add dirent \"%s\", ino #%u\n", new->name, new->ino);
28 29
29 while ((*prev) && (*prev)->nhash <= new->nhash) { 30 while ((*prev) && (*prev)->nhash <= new->nhash) {
30 if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) { 31 if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) {
31 /* Duplicate. Free one */ 32 /* Duplicate. Free one */
32 if (new->version < (*prev)->version) { 33 if (new->version < (*prev)->version) {
33 D1(printk(KERN_DEBUG "Eep! Marking new dirent node obsolete\n")); 34 JFFS2_DBG_DENTLIST("Eep! Marking new dirent node is obsolete, old is \"%s\", ino #%u\n",
34 D1(printk(KERN_DEBUG "New dirent is \"%s\"->ino #%u. Old is \"%s\"->ino #%u\n", new->name, new->ino, (*prev)->name, (*prev)->ino)); 35 (*prev)->name, (*prev)->ino);
35 jffs2_mark_node_obsolete(c, new->raw); 36 jffs2_mark_node_obsolete(c, new->raw);
36 jffs2_free_full_dirent(new); 37 jffs2_free_full_dirent(new);
37 } else { 38 } else {
38 D1(printk(KERN_DEBUG "Marking old dirent node (ino #%u) obsolete\n", (*prev)->ino)); 39 JFFS2_DBG_DENTLIST("marking old dirent \"%s\", ino #%u bsolete\n",
40 (*prev)->name, (*prev)->ino);
39 new->next = (*prev)->next; 41 new->next = (*prev)->next;
40 jffs2_mark_node_obsolete(c, ((*prev)->raw)); 42 jffs2_mark_node_obsolete(c, ((*prev)->raw));
41 jffs2_free_full_dirent(*prev); 43 jffs2_free_full_dirent(*prev);
42 *prev = new; 44 *prev = new;
43 } 45 }
44 goto out; 46 return;
45 } 47 }
46 prev = &((*prev)->next); 48 prev = &((*prev)->next);
47 } 49 }
48 new->next = *prev; 50 new->next = *prev;
49 *prev = new; 51 *prev = new;
50
51 out:
52 D2(while(*list) {
53 printk(KERN_DEBUG "Dirent \"%s\" (hash 0x%08x, ino #%u\n", (*list)->name, (*list)->nhash, (*list)->ino);
54 list = &(*list)->next;
55 });
56} 52}
57 53
58void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this) 54void 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 this->node->frags--; 57 this->node->frags--;
62 if (!this->node->frags) { 58 if (!this->node->frags) {
63 /* The node has no valid frags left. It's totally obsoleted */ 59 /* The node has no valid frags left. It's totally obsoleted */
64 D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) obsolete\n", 60 JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) obsolete\n",
65 ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size)); 61 ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size);
66 jffs2_mark_node_obsolete(c, this->node->raw); 62 jffs2_mark_node_obsolete(c, this->node->raw);
67 jffs2_free_full_dnode(this->node); 63 jffs2_free_full_dnode(this->node);
68 } else { 64 } else {
69 D2(printk(KERN_DEBUG "Marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n", 65 JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n",
70 ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size, 66 ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size, this->node->frags);
71 this->node->frags));
72 mark_ref_normal(this->node->raw); 67 mark_ref_normal(this->node->raw);
73 } 68 }
74 69
@@ -81,20 +76,19 @@ static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_
81 struct rb_node *parent = &base->rb; 76 struct rb_node *parent = &base->rb;
82 struct rb_node **link = &parent; 77 struct rb_node **link = &parent;
83 78
84 D2(printk(KERN_DEBUG "jffs2_fragtree_insert(%p; %d-%d, %p)\n", newfrag, 79 JFFS2_DBG_FRAGTREE2("insert frag (0x%04x-0x%04x)\n", newfrag->ofs, newfrag->ofs + newfrag->size);
85 newfrag->ofs, newfrag->ofs+newfrag->size, base));
86 80
87 while (*link) { 81 while (*link) {
88 parent = *link; 82 parent = *link;
89 base = rb_entry(parent, struct jffs2_node_frag, rb); 83 base = rb_entry(parent, struct jffs2_node_frag, rb);
90 84
91 D2(printk(KERN_DEBUG "fragtree_insert considering frag at 0x%x\n", base->ofs)); 85 JFFS2_DBG_FRAGTREE2("considering frag at 0x%08x\n", base->ofs);
92 if (newfrag->ofs > base->ofs) 86 if (newfrag->ofs > base->ofs)
93 link = &base->rb.rb_right; 87 link = &base->rb.rb_right;
94 else if (newfrag->ofs < base->ofs) 88 else if (newfrag->ofs < base->ofs)
95 link = &base->rb.rb_left; 89 link = &base->rb.rb_left;
96 else { 90 else {
97 printk(KERN_CRIT "Duplicate frag at %08x (%p,%p)\n", newfrag->ofs, newfrag, base); 91 JFFS2_ERROR("duplicate frag at %08x (%p,%p)\n", newfrag->ofs, newfrag, base);
98 BUG(); 92 BUG();
99 } 93 }
100 } 94 }
@@ -112,11 +106,11 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
112 this = jffs2_lookup_node_frag(list, newfrag->node->ofs); 106 this = jffs2_lookup_node_frag(list, newfrag->node->ofs);
113 107
114 if (this) { 108 if (this) {
115 D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n", 109 JFFS2_DBG_FRAGTREE2("lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
116 this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this)); 110 this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this);
117 lastend = this->ofs + this->size; 111 lastend = this->ofs + this->size;
118 } else { 112 } else {
119 D2(printk(KERN_DEBUG "j_a_f_d_t_f: Lookup gave no frag\n")); 113 JFFS2_DBG_FRAGTREE2("lookup gave no frag\n");
120 lastend = 0; 114 lastend = 0;
121 } 115 }
122 116
@@ -148,10 +142,10 @@ static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *l
148 /* By definition, the 'this' node has no right-hand child, 142 /* By definition, the 'this' node has no right-hand child,
149 because there are no frags with offset greater than it. 143 because there are no frags with offset greater than it.
150 So that's where we want to put the hole */ 144 So that's where we want to put the hole */
151 D2(printk(KERN_DEBUG "Adding hole frag (%p) on right of node at (%p)\n", holefrag, this)); 145 JFFS2_DBG_FRAGTREE2("adding hole frag (%p) on right of node at (%p)\n", holefrag, this);
152 rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right); 146 rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right);
153 } else { 147 } else {
154 D2(printk(KERN_DEBUG "Adding hole frag (%p) at root of tree\n", holefrag)); 148 JFFS2_DBG_FRAGTREE2("adding hole frag (%p) at root of tree\n", holefrag);
155 rb_link_node(&holefrag->rb, NULL, &list->rb_node); 149 rb_link_node(&holefrag->rb, NULL, &list->rb_node);
156 } 150 }
157 rb_insert_color(&holefrag->rb, list); 151 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 /* By definition, the 'this' node has no right-hand child, 155 /* By definition, the 'this' node has no right-hand child,
162 because there are no frags with offset greater than it. 156 because there are no frags with offset greater than it.
163 So that's where we want to put new fragment */ 157 So that's where we want to put new fragment */
164 D2(printk(KERN_DEBUG "Adding new frag (%p) on right of node at (%p)\n", newfrag, this)); 158 JFFS2_DBG_FRAGTREE2("adding new frag (%p) on right of node at (%p)\n", newfrag, this);
165 rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right); 159 rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right);
166 } else { 160 } else {
167 D2(printk(KERN_DEBUG "Adding new frag (%p) at root of tree\n", newfrag)); 161 JFFS2_DBG_FRAGTREE2("adding new frag (%p) at root of tree\n", newfrag);
168 rb_link_node(&newfrag->rb, NULL, &list->rb_node); 162 rb_link_node(&newfrag->rb, NULL, &list->rb_node);
169 } 163 }
170 rb_insert_color(&newfrag->rb, list); 164 rb_insert_color(&newfrag->rb, list);
171 return 0; 165 return 0;
172 } 166 }
173 167
174 D2(printk(KERN_DEBUG "j_a_f_d_t_f: dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n", 168 JFFS2_DBG_FRAGTREE2("dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
175 this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this)); 169 this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this);
176 170
177 /* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes, 171 /* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes,
178 * - i.e. newfrag->ofs < this->ofs+this->size && newfrag->ofs >= this->ofs 172 * - 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 jffs2_free_node_frag(newfrag); 187 jffs2_free_node_frag(newfrag);
194 return -ENOMEM; 188 return -ENOMEM;
195 } 189 }
196 D2(printk(KERN_DEBUG "split old frag 0x%04x-0x%04x -->", this->ofs, this->ofs+this->size);
197 if (this->node) 190 if (this->node)
198 printk("phys 0x%08x\n", ref_offset(this->node->raw)); 191 JFFS2_DBG_FRAGTREE2("split old frag 0x%04x-0x%04x, phys 0x%08x\n",
192 this->ofs, this->ofs+this->size, ref_offset(this->node->raw));
199 else 193 else
200 printk("hole\n"); 194 JFFS2_DBG_FRAGTREE2("split old hole frag 0x%04x-0x%04x\n",
201 ) 195 this->ofs, this->ofs+this->size, ref_offset(this->node->raw));
202 196
203 /* New second frag pointing to this's node */ 197 /* New second frag pointing to this's node */
204 newfrag2->ofs = newfrag->ofs + newfrag->size; 198 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 } else { 227 } else {
234 /* New frag starts at the same point as 'this' used to. Replace 228 /* New frag starts at the same point as 'this' used to. Replace
235 it in the tree without doing a delete and insertion */ 229 it in the tree without doing a delete and insertion */
236 D2(printk(KERN_DEBUG "Inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n", 230 JFFS2_DBG_FRAGTREE2("inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
237 newfrag, newfrag->ofs, newfrag->ofs+newfrag->size, 231 newfrag, newfrag->ofs, newfrag->ofs+newfrag->size, this, this->ofs, this->ofs+this->size);
238 this, this->ofs, this->ofs+this->size));
239 232
240 rb_replace_node(&this->rb, &newfrag->rb, list); 233 rb_replace_node(&this->rb, &newfrag->rb, list);
241 234
242 if (newfrag->ofs + newfrag->size >= this->ofs+this->size) { 235 if (newfrag->ofs + newfrag->size >= this->ofs+this->size) {
243 D2(printk(KERN_DEBUG "Obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size)); 236 JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size);
244 jffs2_obsolete_node_frag(c, this); 237 jffs2_obsolete_node_frag(c, this);
245 } else { 238 } else {
246 this->ofs += newfrag->size; 239 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 */ 249 */
257 while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) { 250 while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) {
258 /* 'this' frag is obsoleted completely. */ 251 /* 'this' frag is obsoleted completely. */
259 D2(printk(KERN_DEBUG "Obsoleting node frag %p (%x-%x) and removing from tree\n", this, this->ofs, this->ofs+this->size)); 252 JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x) and removing from tree\n",
253 this, this->ofs, this->ofs+this->size);
260 rb_erase(&this->rb, list); 254 rb_erase(&this->rb, list);
261 jffs2_obsolete_node_frag(c, this); 255 jffs2_obsolete_node_frag(c, this);
262 } 256 }
@@ -286,8 +280,6 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in
286 int ret; 280 int ret;
287 struct jffs2_node_frag *newfrag; 281 struct jffs2_node_frag *newfrag;
288 282
289 D1(printk(KERN_DEBUG "jffs2_add_full_dnode_to_inode(ino #%u, f %p, fn %p)\n", f->inocache->ino, f, fn));
290
291 if (unlikely(!fn->size)) 283 if (unlikely(!fn->size))
292 return 0; 284 return 0;
293 285
@@ -295,8 +287,8 @@ int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_in
295 if (unlikely(!newfrag)) 287 if (unlikely(!newfrag))
296 return -ENOMEM; 288 return -ENOMEM;
297 289
298 D2(printk(KERN_DEBUG "adding node %04x-%04x @0x%08x on flash, newfrag *%p\n", 290 JFFS2_DBG_FRAGTREE("adding node %#04x-%#04x @0x%08x on flash, newfrag *%p\n",
299 fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag)); 291 fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag);
300 292
301 newfrag->ofs = fn->ofs; 293 newfrag->ofs = fn->ofs;
302 newfrag->size = fn->size; 294 newfrag->size = fn->size;
@@ -350,8 +342,6 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t
350{ 342{
351 struct jffs2_inode_cache *ret; 343 struct jffs2_inode_cache *ret;
352 344
353 D2(printk(KERN_DEBUG "jffs2_get_ino_cache(): ino %u\n", ino));
354
355 ret = c->inocache_list[ino % INOCACHE_HASHSIZE]; 345 ret = c->inocache_list[ino % INOCACHE_HASHSIZE];
356 while (ret && ret->ino < ino) { 346 while (ret && ret->ino < ino) {
357 ret = ret->next; 347 ret = ret->next;
@@ -360,7 +350,6 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t
360 if (ret && ret->ino != ino) 350 if (ret && ret->ino != ino)
361 ret = NULL; 351 ret = NULL;
362 352
363 D2(printk(KERN_DEBUG "jffs2_get_ino_cache found %p for ino %u\n", ret, ino));
364 return ret; 353 return ret;
365} 354}
366 355
@@ -372,7 +361,7 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new
372 if (!new->ino) 361 if (!new->ino)
373 new->ino = ++c->highest_ino; 362 new->ino = ++c->highest_ino;
374 363
375 D2(printk(KERN_DEBUG "jffs2_add_ino_cache: Add %p (ino #%u)\n", new, new->ino)); 364 JFFS2_DBG_INOCACHE("add %p (ino #%u)\n", new, new->ino);
376 365
377 prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE]; 366 prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE];
378 367
@@ -388,7 +377,8 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new
388void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) 377void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old)
389{ 378{
390 struct jffs2_inode_cache **prev; 379 struct jffs2_inode_cache **prev;
391 D1(printk(KERN_DEBUG "jffs2_del_ino_cache: Del %p (ino #%u)\n", old, old->ino)); 380
381 JFFS2_DBG_INOCACHE("del %p (ino #%u)\n", old, old->ino);
392 spin_lock(&c->inocache_lock); 382 spin_lock(&c->inocache_lock);
393 383
394 prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE]; 384 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 struct jffs2_node_frag *prev = NULL; 441 struct jffs2_node_frag *prev = NULL;
452 struct jffs2_node_frag *frag = NULL; 442 struct jffs2_node_frag *frag = NULL;
453 443
454 D2(printk(KERN_DEBUG "jffs2_lookup_node_frag(%p, %d)\n", fragtree, offset)); 444 JFFS2_DBG_FRAGTREE2("root %p, offset %d\n", fragtree, offset);
455 445
456 next = fragtree->rb_node; 446 next = fragtree->rb_node;
457 447
458 while(next) { 448 while(next) {
459 frag = rb_entry(next, struct jffs2_node_frag, rb); 449 frag = rb_entry(next, struct jffs2_node_frag, rb);
460 450
461 D2(printk(KERN_DEBUG "Considering frag %d-%d (%p). left %p, right %p\n", 451 JFFS2_DBG_FRAGTREE2("considering frag %#04x-%#04x (%p). left %p, right %p\n",
462 frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right)); 452 frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right);
463 if (frag->ofs + frag->size <= offset) { 453 if (frag->ofs + frag->size <= offset) {
464 D2(printk(KERN_DEBUG "Going right from frag %d-%d, before the region we care about\n", 454 JFFS2_DBG_FRAGTREE2("going right from frag %#04x-%#04x, before the region we care about\n",
465 frag->ofs, frag->ofs+frag->size)); 455 frag->ofs, frag->ofs+frag->size);
466 /* Remember the closest smaller match on the way down */ 456 /* Remember the closest smaller match on the way down */
467 if (!prev || frag->ofs > prev->ofs) 457 if (!prev || frag->ofs > prev->ofs)
468 prev = frag; 458 prev = frag;
469 next = frag->rb.rb_right; 459 next = frag->rb.rb_right;
470 } else if (frag->ofs > offset) { 460 } else if (frag->ofs > offset) {
471 D2(printk(KERN_DEBUG "Going left from frag %d-%d, after the region we care about\n", 461 JFFS2_DBG_FRAGTREE2("going left from frag %#04x-%#04x, after the region we care about\n",
472 frag->ofs, frag->ofs+frag->size)); 462 frag->ofs, frag->ofs+frag->size);
473 next = frag->rb.rb_left; 463 next = frag->rb.rb_left;
474 } else { 464 } else {
475 D2(printk(KERN_DEBUG "Returning frag %d,%d, matched\n", 465 JFFS2_DBG_FRAGTREE2("returning frag %#04x-%#04x, matched\n",
476 frag->ofs, frag->ofs+frag->size)); 466 frag->ofs, frag->ofs+frag->size);
477 return frag; 467 return frag;
478 } 468 }
479 } 469 }
@@ -482,10 +472,10 @@ struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_
482 and return the closest smaller one */ 472 and return the closest smaller one */
483 473
484 if (prev) 474 if (prev)
485 D2(printk(KERN_DEBUG "No match. Returning frag %d,%d, closest previous\n", 475 JFFS2_DBG_FRAGTREE2("no match. Returning frag %#04x-%#04x, closest previous\n",
486 prev->ofs, prev->ofs+prev->size)); 476 prev->ofs, prev->ofs+prev->size);
487 else 477 else
488 D2(printk(KERN_DEBUG "Returning NULL, empty fragtree\n")); 478 JFFS2_DBG_FRAGTREE2("returning NULL, empty fragtree\n");
489 479
490 return prev; 480 return prev;
491} 481}
@@ -500,25 +490,25 @@ void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c)
500 if (!root->rb_node) 490 if (!root->rb_node)
501 return; 491 return;
502 492
493 JFFS2_DBG_FRAGTREE("killing\n");
494
503 frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb)); 495 frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb));
504
505 while(frag) { 496 while(frag) {
506 if (frag->rb.rb_left) { 497 if (frag->rb.rb_left) {
507 D2(printk(KERN_DEBUG "Going left from frag (%p) %d-%d\n", 498 JFFS2_DBG_FRAGTREE2("going left from frag (%p) %#04x-%#04x\n",
508 frag, frag->ofs, frag->ofs+frag->size)); 499 frag, frag->ofs, frag->ofs+frag->size);
509 frag = frag_left(frag); 500 frag = frag_left(frag);
510 continue; 501 continue;
511 } 502 }
512 if (frag->rb.rb_right) { 503 if (frag->rb.rb_right) {
513 D2(printk(KERN_DEBUG "Going right from frag (%p) %d-%d\n", 504 JFFS2_DBG_FRAGTREE2("going right from frag (%p) %#04x-%#04x\n",
514 frag, frag->ofs, frag->ofs+frag->size)); 505 frag, frag->ofs, frag->ofs+frag->size);
515 frag = frag_right(frag); 506 frag = frag_right(frag);
516 continue; 507 continue;
517 } 508 }
518 509
519 D2(printk(KERN_DEBUG "jffs2_kill_fragtree: frag at 0x%x-0x%x: node %p, frags %d--\n", 510 JFFS2_DBG_FRAGTREE2("frag %#04x-%#04x: node %p, frags %d\n",
520 frag->ofs, frag->ofs+frag->size, frag->node, 511 frag->ofs, frag->ofs+frag->size, frag->node, frag->node?frag->node->frags:0);
521 frag->node?frag->node->frags:0));
522 512
523 if (frag->node && !(--frag->node->frags)) { 513 if (frag->node && !(--frag->node->frags)) {
524 /* Not a hole, and it's the final remaining frag 514 /* Not a hole, and it's the final remaining frag