nodelist.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. /*
  2. * JFFS2 -- Journalling Flash File System, Version 2.
  3. *
  4. * Copyright (C) 2001-2003 Red Hat, Inc.
  5. *
  6. * Created by David Woodhouse <dwmw2@infradead.org>
  7. *
  8. * For licensing information, see the file 'LICENCE' in this directory.
  9. *
  10. * $Id: nodelist.c,v 1.103 2005/07/31 08:20:44 dedekind Exp $
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/sched.h>
  15. #include <linux/fs.h>
  16. #include <linux/mtd/mtd.h>
  17. #include <linux/rbtree.h>
  18. #include <linux/crc32.h>
  19. #include <linux/slab.h>
  20. #include <linux/pagemap.h>
  21. #include "nodelist.h"
  22. void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list)
  23. {
  24. struct jffs2_full_dirent **prev = list;
  25. JFFS2_DBG_DENTLIST("add dirent \"%s\", ino #%u\n", new->name, new->ino);
  26. while ((*prev) && (*prev)->nhash <= new->nhash) {
  27. if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) {
  28. /* Duplicate. Free one */
  29. if (new->version < (*prev)->version) {
  30. JFFS2_DBG_DENTLIST("Eep! Marking new dirent node is obsolete, old is \"%s\", ino #%u\n",
  31. (*prev)->name, (*prev)->ino);
  32. jffs2_mark_node_obsolete(c, new->raw);
  33. jffs2_free_full_dirent(new);
  34. } else {
  35. JFFS2_DBG_DENTLIST("marking old dirent \"%s\", ino #%u bsolete\n",
  36. (*prev)->name, (*prev)->ino);
  37. new->next = (*prev)->next;
  38. jffs2_mark_node_obsolete(c, ((*prev)->raw));
  39. jffs2_free_full_dirent(*prev);
  40. *prev = new;
  41. }
  42. return;
  43. }
  44. prev = &((*prev)->next);
  45. }
  46. new->next = *prev;
  47. *prev = new;
  48. }
  49. void jffs2_truncate_fragtree(struct jffs2_sb_info *c, struct rb_root *list, uint32_t size)
  50. {
  51. struct jffs2_node_frag *frag = jffs2_lookup_node_frag(list, size);
  52. JFFS2_DBG_FRAGTREE("truncating fragtree to 0x%08x bytes\n", size);
  53. /* We know frag->ofs <= size. That's what lookup does for us */
  54. if (frag && frag->ofs != size) {
  55. if (frag->ofs+frag->size >= size) {
  56. JFFS2_DBG_FRAGTREE2("truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
  57. frag->size = size - frag->ofs;
  58. }
  59. frag = frag_next(frag);
  60. }
  61. while (frag && frag->ofs >= size) {
  62. struct jffs2_node_frag *next = frag_next(frag);
  63. JFFS2_DBG_FRAGTREE("removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size);
  64. frag_erase(frag, list);
  65. jffs2_obsolete_node_frag(c, frag);
  66. frag = next;
  67. }
  68. }
  69. void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this)
  70. {
  71. if (this->node) {
  72. this->node->frags--;
  73. if (!this->node->frags) {
  74. /* The node has no valid frags left. It's totally obsoleted */
  75. JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) obsolete\n",
  76. ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size);
  77. jffs2_mark_node_obsolete(c, this->node->raw);
  78. jffs2_free_full_dnode(this->node);
  79. } else {
  80. JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n",
  81. ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size, this->node->frags);
  82. mark_ref_normal(this->node->raw);
  83. }
  84. }
  85. jffs2_free_node_frag(this);
  86. }
  87. static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_node_frag *base)
  88. {
  89. struct rb_node *parent = &base->rb;
  90. struct rb_node **link = &parent;
  91. JFFS2_DBG_FRAGTREE2("insert frag (0x%04x-0x%04x)\n", newfrag->ofs, newfrag->ofs + newfrag->size);
  92. while (*link) {
  93. parent = *link;
  94. base = rb_entry(parent, struct jffs2_node_frag, rb);
  95. JFFS2_DBG_FRAGTREE2("considering frag at 0x%08x\n", base->ofs);
  96. if (newfrag->ofs > base->ofs)
  97. link = &base->rb.rb_right;
  98. else if (newfrag->ofs < base->ofs)
  99. link = &base->rb.rb_left;
  100. else {
  101. JFFS2_ERROR("duplicate frag at %08x (%p,%p)\n", newfrag->ofs, newfrag, base);
  102. BUG();
  103. }
  104. }
  105. rb_link_node(&newfrag->rb, &base->rb, link);
  106. }
  107. /* Doesn't set inode->i_size */
  108. static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *list, struct jffs2_node_frag *newfrag)
  109. {
  110. struct jffs2_node_frag *this;
  111. uint32_t lastend;
  112. /* Skip all the nodes which are completed before this one starts */
  113. this = jffs2_lookup_node_frag(list, newfrag->node->ofs);
  114. if (this) {
  115. 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);
  117. lastend = this->ofs + this->size;
  118. } else {
  119. JFFS2_DBG_FRAGTREE2("lookup gave no frag\n");
  120. lastend = 0;
  121. }
  122. /* See if we ran off the end of the list */
  123. if (lastend <= newfrag->ofs) {
  124. /* We did */
  125. /* Check if 'this' node was on the same page as the new node.
  126. If so, both 'this' and the new node get marked REF_NORMAL so
  127. the GC can take a look.
  128. */
  129. if (lastend && (lastend-1) >> PAGE_CACHE_SHIFT == newfrag->ofs >> PAGE_CACHE_SHIFT) {
  130. if (this->node)
  131. mark_ref_normal(this->node->raw);
  132. mark_ref_normal(newfrag->node->raw);
  133. }
  134. if (lastend < newfrag->node->ofs) {
  135. /* ... and we need to put a hole in before the new node */
  136. struct jffs2_node_frag *holefrag = jffs2_alloc_node_frag();
  137. if (!holefrag) {
  138. jffs2_free_node_frag(newfrag);
  139. return -ENOMEM;
  140. }
  141. holefrag->ofs = lastend;
  142. holefrag->size = newfrag->node->ofs - lastend;
  143. holefrag->node = NULL;
  144. if (this) {
  145. /* By definition, the 'this' node has no right-hand child,
  146. because there are no frags with offset greater than it.
  147. So that's where we want to put the hole */
  148. JFFS2_DBG_FRAGTREE2("adding hole frag (%p) on right of node at (%p)\n", holefrag, this);
  149. rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right);
  150. } else {
  151. JFFS2_DBG_FRAGTREE2("adding hole frag (%p) at root of tree\n", holefrag);
  152. rb_link_node(&holefrag->rb, NULL, &list->rb_node);
  153. }
  154. rb_insert_color(&holefrag->rb, list);
  155. this = holefrag;
  156. }
  157. if (this) {
  158. /* By definition, the 'this' node has no right-hand child,
  159. because there are no frags with offset greater than it.
  160. So that's where we want to put new fragment */
  161. JFFS2_DBG_FRAGTREE2("adding new frag (%p) on right of node at (%p)\n", newfrag, this);
  162. rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right);
  163. } else {
  164. JFFS2_DBG_FRAGTREE2("adding new frag (%p) at root of tree\n", newfrag);
  165. rb_link_node(&newfrag->rb, NULL, &list->rb_node);
  166. }
  167. rb_insert_color(&newfrag->rb, list);
  168. return 0;
  169. }
  170. JFFS2_DBG_FRAGTREE2("dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
  171. this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this);
  172. /* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes,
  173. * - i.e. newfrag->ofs < this->ofs+this->size && newfrag->ofs >= this->ofs
  174. */
  175. if (newfrag->ofs > this->ofs) {
  176. /* This node isn't completely obsoleted. The start of it remains valid */
  177. /* Mark the new node and the partially covered node REF_NORMAL -- let
  178. the GC take a look at them */
  179. mark_ref_normal(newfrag->node->raw);
  180. if (this->node)
  181. mark_ref_normal(this->node->raw);
  182. if (this->ofs + this->size > newfrag->ofs + newfrag->size) {
  183. /* The new node splits 'this' frag into two */
  184. struct jffs2_node_frag *newfrag2 = jffs2_alloc_node_frag();
  185. if (!newfrag2) {
  186. jffs2_free_node_frag(newfrag);
  187. return -ENOMEM;
  188. }
  189. if (this->node)
  190. JFFS2_DBG_FRAGTREE2("split old frag 0x%04x-0x%04x, phys 0x%08x\n",
  191. this->ofs, this->ofs+this->size, ref_offset(this->node->raw));
  192. else
  193. JFFS2_DBG_FRAGTREE2("split old hole frag 0x%04x-0x%04x\n",
  194. this->ofs, this->ofs+this->size, ref_offset(this->node->raw));
  195. /* New second frag pointing to this's node */
  196. newfrag2->ofs = newfrag->ofs + newfrag->size;
  197. newfrag2->size = (this->ofs+this->size) - newfrag2->ofs;
  198. newfrag2->node = this->node;
  199. if (this->node)
  200. this->node->frags++;
  201. /* Adjust size of original 'this' */
  202. this->size = newfrag->ofs - this->ofs;
  203. /* Now, we know there's no node with offset
  204. greater than this->ofs but smaller than
  205. newfrag2->ofs or newfrag->ofs, for obvious
  206. reasons. So we can do a tree insert from
  207. 'this' to insert newfrag, and a tree insert
  208. from newfrag to insert newfrag2. */
  209. jffs2_fragtree_insert(newfrag, this);
  210. rb_insert_color(&newfrag->rb, list);
  211. jffs2_fragtree_insert(newfrag2, newfrag);
  212. rb_insert_color(&newfrag2->rb, list);
  213. return 0;
  214. }
  215. /* New node just reduces 'this' frag in size, doesn't split it */
  216. this->size = newfrag->ofs - this->ofs;
  217. /* Again, we know it lives down here in the tree */
  218. jffs2_fragtree_insert(newfrag, this);
  219. rb_insert_color(&newfrag->rb, list);
  220. } else {
  221. /* New frag starts at the same point as 'this' used to. Replace
  222. it in the tree without doing a delete and insertion */
  223. JFFS2_DBG_FRAGTREE2("inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
  224. newfrag, newfrag->ofs, newfrag->ofs+newfrag->size, this, this->ofs, this->ofs+this->size);
  225. rb_replace_node(&this->rb, &newfrag->rb, list);
  226. if (newfrag->ofs + newfrag->size >= this->ofs+this->size) {
  227. JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size);
  228. jffs2_obsolete_node_frag(c, this);
  229. } else {
  230. this->ofs += newfrag->size;
  231. this->size -= newfrag->size;
  232. jffs2_fragtree_insert(this, newfrag);
  233. rb_insert_color(&this->rb, list);
  234. return 0;
  235. }
  236. }
  237. /* OK, now we have newfrag added in the correct place in the tree, but
  238. frag_next(newfrag) may be a fragment which is overlapped by it
  239. */
  240. while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) {
  241. /* 'this' frag is obsoleted completely. */
  242. JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x) and removing from tree\n",
  243. this, this->ofs, this->ofs+this->size);
  244. rb_erase(&this->rb, list);
  245. jffs2_obsolete_node_frag(c, this);
  246. }
  247. /* Now we're pointing at the first frag which isn't totally obsoleted by
  248. the new frag */
  249. if (!this || newfrag->ofs + newfrag->size == this->ofs) {
  250. return 0;
  251. }
  252. /* Still some overlap but we don't need to move it in the tree */
  253. this->size = (this->ofs + this->size) - (newfrag->ofs + newfrag->size);
  254. this->ofs = newfrag->ofs + newfrag->size;
  255. /* And mark them REF_NORMAL so the GC takes a look at them */
  256. if (this->node)
  257. mark_ref_normal(this->node->raw);
  258. mark_ref_normal(newfrag->node->raw);
  259. return 0;
  260. }
  261. /* Given an inode, probably with existing list of fragments, add the new node
  262. * to the fragment list.
  263. */
  264. int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn)
  265. {
  266. int ret;
  267. struct jffs2_node_frag *newfrag;
  268. if (unlikely(!fn->size))
  269. return 0;
  270. newfrag = jffs2_alloc_node_frag();
  271. if (unlikely(!newfrag))
  272. return -ENOMEM;
  273. JFFS2_DBG_FRAGTREE("adding node %#04x-%#04x @0x%08x on flash, newfrag *%p\n",
  274. fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag);
  275. newfrag->ofs = fn->ofs;
  276. newfrag->size = fn->size;
  277. newfrag->node = fn;
  278. newfrag->node->frags = 1;
  279. ret = jffs2_add_frag_to_fragtree(c, &f->fragtree, newfrag);
  280. if (unlikely(ret))
  281. return ret;
  282. /* If we now share a page with other nodes, mark either previous
  283. or next node REF_NORMAL, as appropriate. */
  284. if (newfrag->ofs & (PAGE_CACHE_SIZE-1)) {
  285. struct jffs2_node_frag *prev = frag_prev(newfrag);
  286. mark_ref_normal(fn->raw);
  287. /* If we don't start at zero there's _always_ a previous */
  288. if (prev->node)
  289. mark_ref_normal(prev->node->raw);
  290. }
  291. if ((newfrag->ofs+newfrag->size) & (PAGE_CACHE_SIZE-1)) {
  292. struct jffs2_node_frag *next = frag_next(newfrag);
  293. if (next) {
  294. mark_ref_normal(fn->raw);
  295. if (next->node)
  296. mark_ref_normal(next->node->raw);
  297. }
  298. }
  299. jffs2_dbg_fragtree_paranoia_check_nolock(f);
  300. jffs2_dbg_dump_fragtree_nolock(f);
  301. return 0;
  302. }
  303. void jffs2_set_inocache_state(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic, int state)
  304. {
  305. spin_lock(&c->inocache_lock);
  306. ic->state = state;
  307. wake_up(&c->inocache_wq);
  308. spin_unlock(&c->inocache_lock);
  309. }
  310. /* During mount, this needs no locking. During normal operation, its
  311. callers want to do other stuff while still holding the inocache_lock.
  312. Rather than introducing special case get_ino_cache functions or
  313. callbacks, we just let the caller do the locking itself. */
  314. struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t ino)
  315. {
  316. struct jffs2_inode_cache *ret;
  317. ret = c->inocache_list[ino % INOCACHE_HASHSIZE];
  318. while (ret && ret->ino < ino) {
  319. ret = ret->next;
  320. }
  321. if (ret && ret->ino != ino)
  322. ret = NULL;
  323. return ret;
  324. }
  325. void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new)
  326. {
  327. struct jffs2_inode_cache **prev;
  328. spin_lock(&c->inocache_lock);
  329. if (!new->ino)
  330. new->ino = ++c->highest_ino;
  331. JFFS2_DBG_INOCACHE("add %p (ino #%u)\n", new, new->ino);
  332. prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE];
  333. while ((*prev) && (*prev)->ino < new->ino) {
  334. prev = &(*prev)->next;
  335. }
  336. new->next = *prev;
  337. *prev = new;
  338. spin_unlock(&c->inocache_lock);
  339. }
  340. void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old)
  341. {
  342. struct jffs2_inode_cache **prev;
  343. JFFS2_DBG_INOCACHE("del %p (ino #%u)\n", old, old->ino);
  344. spin_lock(&c->inocache_lock);
  345. prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE];
  346. while ((*prev) && (*prev)->ino < old->ino) {
  347. prev = &(*prev)->next;
  348. }
  349. if ((*prev) == old) {
  350. *prev = old->next;
  351. }
  352. /* Free it now unless it's in READING or CLEARING state, which
  353. are the transitions upon read_inode() and clear_inode(). The
  354. rest of the time we know nobody else is looking at it, and
  355. if it's held by read_inode() or clear_inode() they'll free it
  356. for themselves. */
  357. if (old->state != INO_STATE_READING && old->state != INO_STATE_CLEARING)
  358. jffs2_free_inode_cache(old);
  359. spin_unlock(&c->inocache_lock);
  360. }
  361. void jffs2_free_ino_caches(struct jffs2_sb_info *c)
  362. {
  363. int i;
  364. struct jffs2_inode_cache *this, *next;
  365. for (i=0; i<INOCACHE_HASHSIZE; i++) {
  366. this = c->inocache_list[i];
  367. while (this) {
  368. next = this->next;
  369. jffs2_free_inode_cache(this);
  370. this = next;
  371. }
  372. c->inocache_list[i] = NULL;
  373. }
  374. }
  375. void jffs2_free_raw_node_refs(struct jffs2_sb_info *c)
  376. {
  377. int i;
  378. struct jffs2_raw_node_ref *this, *next;
  379. for (i=0; i<c->nr_blocks; i++) {
  380. this = c->blocks[i].first_node;
  381. while(this) {
  382. next = this->next_phys;
  383. jffs2_free_raw_node_ref(this);
  384. this = next;
  385. }
  386. c->blocks[i].first_node = c->blocks[i].last_node = NULL;
  387. }
  388. }
  389. struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_t offset)
  390. {
  391. /* The common case in lookup is that there will be a node
  392. which precisely matches. So we go looking for that first */
  393. struct rb_node *next;
  394. struct jffs2_node_frag *prev = NULL;
  395. struct jffs2_node_frag *frag = NULL;
  396. JFFS2_DBG_FRAGTREE2("root %p, offset %d\n", fragtree, offset);
  397. next = fragtree->rb_node;
  398. while(next) {
  399. frag = rb_entry(next, struct jffs2_node_frag, rb);
  400. JFFS2_DBG_FRAGTREE2("considering frag %#04x-%#04x (%p). left %p, right %p\n",
  401. frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right);
  402. if (frag->ofs + frag->size <= offset) {
  403. JFFS2_DBG_FRAGTREE2("going right from frag %#04x-%#04x, before the region we care about\n",
  404. frag->ofs, frag->ofs+frag->size);
  405. /* Remember the closest smaller match on the way down */
  406. if (!prev || frag->ofs > prev->ofs)
  407. prev = frag;
  408. next = frag->rb.rb_right;
  409. } else if (frag->ofs > offset) {
  410. JFFS2_DBG_FRAGTREE2("going left from frag %#04x-%#04x, after the region we care about\n",
  411. frag->ofs, frag->ofs+frag->size);
  412. next = frag->rb.rb_left;
  413. } else {
  414. JFFS2_DBG_FRAGTREE2("returning frag %#04x-%#04x, matched\n",
  415. frag->ofs, frag->ofs+frag->size);
  416. return frag;
  417. }
  418. }
  419. /* Exact match not found. Go back up looking at each parent,
  420. and return the closest smaller one */
  421. if (prev)
  422. JFFS2_DBG_FRAGTREE2("no match. Returning frag %#04x-%#04x, closest previous\n",
  423. prev->ofs, prev->ofs+prev->size);
  424. else
  425. JFFS2_DBG_FRAGTREE2("returning NULL, empty fragtree\n");
  426. return prev;
  427. }
  428. /* Pass 'c' argument to indicate that nodes should be marked obsolete as
  429. they're killed. */
  430. void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c)
  431. {
  432. struct jffs2_node_frag *frag;
  433. struct jffs2_node_frag *parent;
  434. if (!root->rb_node)
  435. return;
  436. JFFS2_DBG_FRAGTREE("killing\n");
  437. frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb));
  438. while(frag) {
  439. if (frag->rb.rb_left) {
  440. JFFS2_DBG_FRAGTREE2("going left from frag (%p) %#04x-%#04x\n",
  441. frag, frag->ofs, frag->ofs+frag->size);
  442. frag = frag_left(frag);
  443. continue;
  444. }
  445. if (frag->rb.rb_right) {
  446. JFFS2_DBG_FRAGTREE2("going right from frag (%p) %#04x-%#04x\n",
  447. frag, frag->ofs, frag->ofs+frag->size);
  448. frag = frag_right(frag);
  449. continue;
  450. }
  451. JFFS2_DBG_FRAGTREE2("frag %#04x-%#04x: node %p, frags %d\n",
  452. frag->ofs, frag->ofs+frag->size, frag->node, frag->node?frag->node->frags:0);
  453. if (frag->node && !(--frag->node->frags)) {
  454. /* Not a hole, and it's the final remaining frag
  455. of this node. Free the node */
  456. if (c)
  457. jffs2_mark_node_obsolete(c, frag->node->raw);
  458. jffs2_free_full_dnode(frag->node);
  459. }
  460. parent = frag_parent(frag);
  461. if (parent) {
  462. if (frag_left(parent) == frag)
  463. parent->rb.rb_left = NULL;
  464. else
  465. parent->rb.rb_right = NULL;
  466. }
  467. jffs2_free_node_frag(frag);
  468. frag = parent;
  469. cond_resched();
  470. }
  471. }