210 return 0;
211}
212
213
214static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *root, struct jffs2_node_frag *newfrag)
215{
216 struct jffs2_node_frag *this;
217 uint32_t lastend;
218
219
220 this = jffs2_lookup_node_frag(root, newfrag->node->ofs);
221
222 if (this) {
223 dbg_fragtree2("lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n",
224 this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this);
225 lastend = this->ofs + this->size;
226 } else {
227 dbg_fragtree2("lookup gave no frag\n");
228 lastend = 0;
229 }
230
231
232 if (lastend <= newfrag->ofs) {
233
234
235
236
237
238
239 if (lastend && (lastend-1) >> PAGE_CACHE_SHIFT == newfrag->ofs >> PAGE_CACHE_SHIFT) {
240 if (this->node)
241 mark_ref_normal(this->node->raw);
242 mark_ref_normal(newfrag->node->raw);
243 }
244
245 return no_overlapping_node(c, root, newfrag, this, lastend);
246 }
247
248 if (this->node)
249 dbg_fragtree2("dealing with frag %u-%u, phys %#08x(%d).\n",
250 this->ofs, this->ofs + this->size,