• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/fs/jffs2/

Lines Matching defs:newfrag

120 static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_node_frag *base)
125 dbg_fragtree2("insert frag (0x%04x-0x%04x)\n", newfrag->ofs, newfrag->ofs + newfrag->size);
131 if (newfrag->ofs > base->ofs)
133 else if (newfrag->ofs < base->ofs)
136 JFFS2_ERROR("duplicate frag at %08x (%p,%p)\n", newfrag->ofs, newfrag, base);
141 rb_link_node(&newfrag->rb, &base->rb, link);
149 struct jffs2_node_frag *newfrag;
151 newfrag = jffs2_alloc_node_frag();
152 if (likely(newfrag)) {
153 newfrag->ofs = ofs;
154 newfrag->size = size;
155 newfrag->node = fn;
160 return newfrag;
168 struct jffs2_node_frag *newfrag,
171 if (lastend < newfrag->node->ofs) {
175 holefrag= new_fragment(NULL, lastend, newfrag->node->ofs - lastend);
177 jffs2_free_node_frag(newfrag);
202 rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right);
205 rb_link_node(&newfrag->rb, NULL, &root->rb_node);
207 rb_insert_color(&newfrag->rb, root);
213 static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *root, struct jffs2_node_frag *newfrag)
219 this = jffs2_lookup_node_frag(root, newfrag->node->ofs);
231 if (lastend <= newfrag->ofs) {
238 if (lastend && (lastend-1) >> PAGE_CACHE_SHIFT == newfrag->ofs >> PAGE_CACHE_SHIFT) {
241 mark_ref_normal(newfrag->node->raw);
244 return no_overlapping_node(c, root, newfrag, this, lastend);
255 /* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes,
256 * - i.e. newfrag->ofs < this->ofs+this->size && newfrag->ofs >= this->ofs
258 if (newfrag->ofs > this->ofs) {
263 mark_ref_normal(newfrag->node->raw);
267 if (this->ofs + this->size > newfrag->ofs + newfrag->size) {
279 newfrag2 = new_fragment(this->node, newfrag->ofs + newfrag->size,
280 this->ofs + this->size - newfrag->ofs - newfrag->size);
287 this->size = newfrag->ofs - this->ofs;
291 newfrag2->ofs or newfrag->ofs, for obvious
293 'this' to insert newfrag, and a tree insert
294 from newfrag to insert newfrag2. */
295 jffs2_fragtree_insert(newfrag, this);
296 rb_insert_color(&newfrag->rb, root);
298 jffs2_fragtree_insert(newfrag2, newfrag);
304 this->size = newfrag->ofs - this->ofs;
307 jffs2_fragtree_insert(newfrag, this);
308 rb_insert_color(&newfrag->rb, root);
312 dbg_fragtree2("inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n",
313 newfrag, newfrag->ofs, newfrag->ofs+newfrag->size, this, this->ofs, this->ofs+this->size);
315 rb_replace_node(&this->rb, &newfrag->rb, root);
317 if (newfrag->ofs + newfrag->size >= this->ofs+this->size) {
321 this->ofs += newfrag->size;
322 this->size -= newfrag->size;
324 jffs2_fragtree_insert(this, newfrag);
329 /* OK, now we have newfrag added in the correct place in the tree, but
330 frag_next(newfrag) may be a fragment which is overlapped by it
332 while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) {
342 if (!this || newfrag->ofs + newfrag->size == this->ofs)
346 this->size = (this->ofs + this->size) - (newfrag->ofs + newfrag->size);
347 this->ofs = newfrag->ofs + newfrag->size;
352 mark_ref_normal(newfrag->node->raw);
364 struct jffs2_node_frag *newfrag;
369 newfrag = new_fragment(fn, fn->ofs, fn->size);
370 if (unlikely(!newfrag))
372 newfrag->node->frags = 1;
374 dbg_fragtree("adding node %#04x-%#04x @0x%08x on flash, newfrag *%p\n",
375 fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag);
377 ret = jffs2_add_frag_to_fragtree(c, &f->fragtree, newfrag);
383 if (newfrag->ofs & (PAGE_CACHE_SIZE-1)) {
384 struct jffs2_node_frag *prev = frag_prev(newfrag);
392 if ((newfrag->ofs+newfrag->size) & (PAGE_CACHE_SIZE-1)) {
393 struct jffs2_node_frag *next = frag_next(newfrag);