Lines Matching refs:jeb
243 static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) in jffs2_close_nextblock() argument
248 __func__, jeb->offset); in jffs2_close_nextblock()
252 if (ISDIRTY (jeb->wasted_size + jeb->dirty_size)) { in jffs2_close_nextblock()
253 c->dirty_size += jeb->wasted_size; in jffs2_close_nextblock()
254 c->wasted_size -= jeb->wasted_size; in jffs2_close_nextblock()
255 jeb->dirty_size += jeb->wasted_size; in jffs2_close_nextblock()
256 jeb->wasted_size = 0; in jffs2_close_nextblock()
257 if (VERYDIRTY(c, jeb->dirty_size)) { in jffs2_close_nextblock()
259 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_close_nextblock()
260 jeb->used_size); in jffs2_close_nextblock()
261 list_add_tail(&jeb->list, &c->very_dirty_list); in jffs2_close_nextblock()
264 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_close_nextblock()
265 jeb->used_size); in jffs2_close_nextblock()
266 list_add_tail(&jeb->list, &c->dirty_list); in jffs2_close_nextblock()
270 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_close_nextblock()
271 jeb->used_size); in jffs2_close_nextblock()
272 list_add_tail(&jeb->list, &c->clean_list); in jffs2_close_nextblock()
357 struct jffs2_eraseblock *jeb = c->nextblock; in jffs2_do_reserve_space() local
367 if (jeb) { in jffs2_do_reserve_space()
371 minsize, jeb->free_size, in jffs2_do_reserve_space()
377 if (jeb && (PAD(minsize) + PAD(c->summary->sum_size + sumsize + in jffs2_do_reserve_space()
378 JFFS2_SUMMARY_FRAME_SIZE) > jeb->free_size)) { in jffs2_do_reserve_space()
387 dbg_summary("generating summary for 0x%08x.\n", jeb->offset); in jffs2_do_reserve_space()
401 jffs2_close_nextblock(c, jeb); in jffs2_do_reserve_space()
402 jeb = NULL; in jffs2_do_reserve_space()
407 if (jeb && minsize > jeb->free_size) { in jffs2_do_reserve_space()
419 jeb = c->nextblock; in jffs2_do_reserve_space()
425 ret = jffs2_prealloc_raw_node_refs(c, jeb, 1); in jffs2_do_reserve_space()
436 waste = jeb->free_size; in jffs2_do_reserve_space()
437 jffs2_link_node_ref(c, jeb, in jffs2_do_reserve_space()
438 (jeb->offset + c->sector_size - waste) | REF_OBSOLETE, in jffs2_do_reserve_space()
441 jeb->dirty_size -= waste; in jffs2_do_reserve_space()
443 jeb->wasted_size += waste; in jffs2_do_reserve_space()
446 jffs2_close_nextblock(c, jeb); in jffs2_do_reserve_space()
447 jeb = NULL; in jffs2_do_reserve_space()
451 if (!jeb) { in jffs2_do_reserve_space()
457 jeb = c->nextblock; in jffs2_do_reserve_space()
459 if (jeb->free_size != c->sector_size - c->cleanmarker_size) { in jffs2_do_reserve_space()
461 jeb->offset, jeb->free_size); in jffs2_do_reserve_space()
467 *len = jeb->free_size - reserved_size; in jffs2_do_reserve_space()
469 if (c->cleanmarker_size && jeb->used_size == c->cleanmarker_size && in jffs2_do_reserve_space()
470 !jeb->first_node->next_in_ino) { in jffs2_do_reserve_space()
478 jffs2_mark_node_obsolete(c, jeb->first_node); in jffs2_do_reserve_space()
484 *len, jeb->offset + (c->sector_size - jeb->free_size)); in jffs2_do_reserve_space()
504 struct jffs2_eraseblock *jeb; in jffs2_add_physical_node_ref() local
507 jeb = &c->blocks[ofs / c->sector_size]; in jffs2_add_physical_node_ref()
516 && (jeb != c->nextblock || (ofs & ~3) != jeb->offset + (c->sector_size - jeb->free_size))) { in jffs2_add_physical_node_ref()
524 jeb->offset + (c->sector_size - jeb->free_size)); in jffs2_add_physical_node_ref()
530 new = jffs2_link_node_ref(c, jeb, ofs, len, ic); in jffs2_add_physical_node_ref()
532 if (!jeb->free_size && !jeb->dirty_size && !ISDIRTY(jeb->wasted_size)) { in jffs2_add_physical_node_ref()
535 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_add_physical_node_ref()
536 jeb->used_size); in jffs2_add_physical_node_ref()
544 list_add_tail(&jeb->list, &c->clean_list); in jffs2_add_physical_node_ref()
547 jffs2_dbg_acct_sanity_check_nolock(c,jeb); in jffs2_add_physical_node_ref()
548 jffs2_dbg_acct_paranoia_check_nolock(c, jeb); in jffs2_add_physical_node_ref()
581 struct jffs2_eraseblock *jeb; in jffs2_mark_node_obsolete() local
603 jeb = &c->blocks[blocknr]; in jffs2_mark_node_obsolete()
618 freed_len = ref_totlen(c, jeb, ref); in jffs2_mark_node_obsolete()
621 D1(if (unlikely(jeb->unchecked_size < freed_len)) { in jffs2_mark_node_obsolete()
624 ref->flash_offset, jeb->used_size); in jffs2_mark_node_obsolete()
629 jeb->unchecked_size -= freed_len; in jffs2_mark_node_obsolete()
632 D1(if (unlikely(jeb->used_size < freed_len)) { in jffs2_mark_node_obsolete()
635 ref->flash_offset, jeb->used_size); in jffs2_mark_node_obsolete()
640 jeb->used_size -= freed_len; in jffs2_mark_node_obsolete()
645 if ((jeb->dirty_size || ISDIRTY(jeb->wasted_size + freed_len)) && jeb != c->nextblock) { in jffs2_mark_node_obsolete()
648 jeb->dirty_size += freed_len; in jffs2_mark_node_obsolete()
652 if (jeb->wasted_size) { in jffs2_mark_node_obsolete()
653 if (on_list(&jeb->list, &c->bad_used_list)) { in jffs2_mark_node_obsolete()
655 jeb->offset); in jffs2_mark_node_obsolete()
659 jeb->wasted_size, jeb->offset); in jffs2_mark_node_obsolete()
660 addedsize += jeb->wasted_size; in jffs2_mark_node_obsolete()
661 jeb->dirty_size += jeb->wasted_size; in jffs2_mark_node_obsolete()
662 c->dirty_size += jeb->wasted_size; in jffs2_mark_node_obsolete()
663 c->wasted_size -= jeb->wasted_size; in jffs2_mark_node_obsolete()
664 jeb->wasted_size = 0; in jffs2_mark_node_obsolete()
670 jeb->wasted_size += freed_len; in jffs2_mark_node_obsolete()
675 jffs2_dbg_acct_sanity_check_nolock(c, jeb); in jffs2_mark_node_obsolete()
676 jffs2_dbg_acct_paranoia_check_nolock(c, jeb); in jffs2_mark_node_obsolete()
689 if (jeb == c->nextblock) { in jffs2_mark_node_obsolete()
691 jeb->offset); in jffs2_mark_node_obsolete()
692 } else if (!jeb->used_size && !jeb->unchecked_size) { in jffs2_mark_node_obsolete()
693 if (jeb == c->gcblock) { in jffs2_mark_node_obsolete()
695 jeb->offset); in jffs2_mark_node_obsolete()
699 jeb->offset); in jffs2_mark_node_obsolete()
700 list_del(&jeb->list); in jffs2_mark_node_obsolete()
704 list_add_tail(&jeb->list, &c->erasable_pending_wbuf_list); in jffs2_mark_node_obsolete()
710 list_add_tail(&jeb->list, &c->erase_pending_list); in jffs2_mark_node_obsolete()
717 list_add_tail(&jeb->list, &c->erasable_list); in jffs2_mark_node_obsolete()
721 } else if (jeb == c->gcblock) { in jffs2_mark_node_obsolete()
723 jeb->offset); in jffs2_mark_node_obsolete()
724 } else if (ISDIRTY(jeb->dirty_size) && !ISDIRTY(jeb->dirty_size - addedsize)) { in jffs2_mark_node_obsolete()
726 jeb->offset); in jffs2_mark_node_obsolete()
727 list_del(&jeb->list); in jffs2_mark_node_obsolete()
729 list_add_tail(&jeb->list, &c->dirty_list); in jffs2_mark_node_obsolete()
730 } else if (VERYDIRTY(c, jeb->dirty_size) && in jffs2_mark_node_obsolete()
731 !VERYDIRTY(c, jeb->dirty_size - addedsize)) { in jffs2_mark_node_obsolete()
733 jeb->offset); in jffs2_mark_node_obsolete()
734 list_del(&jeb->list); in jffs2_mark_node_obsolete()
736 list_add_tail(&jeb->list, &c->very_dirty_list); in jffs2_mark_node_obsolete()
739 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_mark_node_obsolete()
740 jeb->used_size); in jffs2_mark_node_obsolete()
842 struct jffs2_eraseblock *jeb; in jffs2_thread_should_wake() local
868 list_for_each_entry(jeb, &c->very_dirty_list, list) { in jffs2_thread_should_wake()