Lines Matching refs:jeb
246 static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) in jffs2_close_nextblock() argument
251 __func__, jeb->offset); in jffs2_close_nextblock()
255 if (ISDIRTY (jeb->wasted_size + jeb->dirty_size)) { in jffs2_close_nextblock()
256 c->dirty_size += jeb->wasted_size; in jffs2_close_nextblock()
257 c->wasted_size -= jeb->wasted_size; in jffs2_close_nextblock()
258 jeb->dirty_size += jeb->wasted_size; in jffs2_close_nextblock()
259 jeb->wasted_size = 0; in jffs2_close_nextblock()
260 if (VERYDIRTY(c, jeb->dirty_size)) { in jffs2_close_nextblock()
262 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_close_nextblock()
263 jeb->used_size); in jffs2_close_nextblock()
264 list_add_tail(&jeb->list, &c->very_dirty_list); in jffs2_close_nextblock()
267 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_close_nextblock()
268 jeb->used_size); in jffs2_close_nextblock()
269 list_add_tail(&jeb->list, &c->dirty_list); in jffs2_close_nextblock()
273 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_close_nextblock()
274 jeb->used_size); in jffs2_close_nextblock()
275 list_add_tail(&jeb->list, &c->clean_list); in jffs2_close_nextblock()
360 struct jffs2_eraseblock *jeb = c->nextblock; in jffs2_do_reserve_space() local
370 if (jeb) { in jffs2_do_reserve_space()
374 minsize, jeb->free_size, in jffs2_do_reserve_space()
380 if (jeb && (PAD(minsize) + PAD(c->summary->sum_size + sumsize + in jffs2_do_reserve_space()
381 JFFS2_SUMMARY_FRAME_SIZE) > jeb->free_size)) { in jffs2_do_reserve_space()
390 dbg_summary("generating summary for 0x%08x.\n", jeb->offset); in jffs2_do_reserve_space()
404 jffs2_close_nextblock(c, jeb); in jffs2_do_reserve_space()
405 jeb = NULL; in jffs2_do_reserve_space()
410 if (jeb && minsize > jeb->free_size) { in jffs2_do_reserve_space()
422 jeb = c->nextblock; in jffs2_do_reserve_space()
428 ret = jffs2_prealloc_raw_node_refs(c, jeb, 1); in jffs2_do_reserve_space()
439 waste = jeb->free_size; in jffs2_do_reserve_space()
440 jffs2_link_node_ref(c, jeb, in jffs2_do_reserve_space()
441 (jeb->offset + c->sector_size - waste) | REF_OBSOLETE, in jffs2_do_reserve_space()
444 jeb->dirty_size -= waste; in jffs2_do_reserve_space()
446 jeb->wasted_size += waste; in jffs2_do_reserve_space()
449 jffs2_close_nextblock(c, jeb); in jffs2_do_reserve_space()
450 jeb = NULL; in jffs2_do_reserve_space()
454 if (!jeb) { in jffs2_do_reserve_space()
460 jeb = c->nextblock; in jffs2_do_reserve_space()
462 if (jeb->free_size != c->sector_size - c->cleanmarker_size) { in jffs2_do_reserve_space()
464 jeb->offset, jeb->free_size); in jffs2_do_reserve_space()
470 *len = jeb->free_size - reserved_size; in jffs2_do_reserve_space()
472 if (c->cleanmarker_size && jeb->used_size == c->cleanmarker_size && in jffs2_do_reserve_space()
473 !jeb->first_node->next_in_ino) { in jffs2_do_reserve_space()
481 jffs2_mark_node_obsolete(c, jeb->first_node); in jffs2_do_reserve_space()
487 *len, jeb->offset + (c->sector_size - jeb->free_size)); in jffs2_do_reserve_space()
510 struct jffs2_eraseblock *jeb; in jffs2_add_physical_node_ref() local
513 jeb = &c->blocks[ofs / c->sector_size]; in jffs2_add_physical_node_ref()
522 && (jeb != c->nextblock || (ofs & ~3) != jeb->offset + (c->sector_size - jeb->free_size))) { in jffs2_add_physical_node_ref()
530 jeb->offset + (c->sector_size - jeb->free_size)); in jffs2_add_physical_node_ref()
536 new = jffs2_link_node_ref(c, jeb, ofs, len, ic); in jffs2_add_physical_node_ref()
538 if (!jeb->free_size && !jeb->dirty_size && !ISDIRTY(jeb->wasted_size)) { in jffs2_add_physical_node_ref()
541 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_add_physical_node_ref()
542 jeb->used_size); in jffs2_add_physical_node_ref()
550 list_add_tail(&jeb->list, &c->clean_list); in jffs2_add_physical_node_ref()
553 jffs2_dbg_acct_sanity_check_nolock(c,jeb); in jffs2_add_physical_node_ref()
554 jffs2_dbg_acct_paranoia_check_nolock(c, jeb); in jffs2_add_physical_node_ref()
587 struct jffs2_eraseblock *jeb; in jffs2_mark_node_obsolete() local
609 jeb = &c->blocks[blocknr]; in jffs2_mark_node_obsolete()
624 freed_len = ref_totlen(c, jeb, ref); in jffs2_mark_node_obsolete()
627 D1(if (unlikely(jeb->unchecked_size < freed_len)) { in jffs2_mark_node_obsolete()
630 ref->flash_offset, jeb->used_size); in jffs2_mark_node_obsolete()
635 jeb->unchecked_size -= freed_len; in jffs2_mark_node_obsolete()
638 D1(if (unlikely(jeb->used_size < freed_len)) { in jffs2_mark_node_obsolete()
641 ref->flash_offset, jeb->used_size); in jffs2_mark_node_obsolete()
646 jeb->used_size -= freed_len; in jffs2_mark_node_obsolete()
651 if ((jeb->dirty_size || ISDIRTY(jeb->wasted_size + freed_len)) && jeb != c->nextblock) { in jffs2_mark_node_obsolete()
654 jeb->dirty_size += freed_len; in jffs2_mark_node_obsolete()
658 if (jeb->wasted_size) { in jffs2_mark_node_obsolete()
659 if (on_list(&jeb->list, &c->bad_used_list)) { in jffs2_mark_node_obsolete()
661 jeb->offset); in jffs2_mark_node_obsolete()
665 jeb->wasted_size, jeb->offset); in jffs2_mark_node_obsolete()
666 addedsize += jeb->wasted_size; in jffs2_mark_node_obsolete()
667 jeb->dirty_size += jeb->wasted_size; in jffs2_mark_node_obsolete()
668 c->dirty_size += jeb->wasted_size; in jffs2_mark_node_obsolete()
669 c->wasted_size -= jeb->wasted_size; in jffs2_mark_node_obsolete()
670 jeb->wasted_size = 0; in jffs2_mark_node_obsolete()
676 jeb->wasted_size += freed_len; in jffs2_mark_node_obsolete()
681 jffs2_dbg_acct_sanity_check_nolock(c, jeb); in jffs2_mark_node_obsolete()
682 jffs2_dbg_acct_paranoia_check_nolock(c, jeb); in jffs2_mark_node_obsolete()
695 if (jeb == c->nextblock) { in jffs2_mark_node_obsolete()
697 jeb->offset); in jffs2_mark_node_obsolete()
698 } else if (!jeb->used_size && !jeb->unchecked_size) { in jffs2_mark_node_obsolete()
699 if (jeb == c->gcblock) { in jffs2_mark_node_obsolete()
701 jeb->offset); in jffs2_mark_node_obsolete()
705 jeb->offset); in jffs2_mark_node_obsolete()
706 list_del(&jeb->list); in jffs2_mark_node_obsolete()
710 list_add_tail(&jeb->list, &c->erasable_pending_wbuf_list); in jffs2_mark_node_obsolete()
716 list_add_tail(&jeb->list, &c->erase_pending_list); in jffs2_mark_node_obsolete()
723 list_add_tail(&jeb->list, &c->erasable_list); in jffs2_mark_node_obsolete()
727 } else if (jeb == c->gcblock) { in jffs2_mark_node_obsolete()
729 jeb->offset); in jffs2_mark_node_obsolete()
730 } else if (ISDIRTY(jeb->dirty_size) && !ISDIRTY(jeb->dirty_size - addedsize)) { in jffs2_mark_node_obsolete()
732 jeb->offset); in jffs2_mark_node_obsolete()
733 list_del(&jeb->list); in jffs2_mark_node_obsolete()
735 list_add_tail(&jeb->list, &c->dirty_list); in jffs2_mark_node_obsolete()
736 } else if (VERYDIRTY(c, jeb->dirty_size) && in jffs2_mark_node_obsolete()
737 !VERYDIRTY(c, jeb->dirty_size - addedsize)) { in jffs2_mark_node_obsolete()
739 jeb->offset); in jffs2_mark_node_obsolete()
740 list_del(&jeb->list); in jffs2_mark_node_obsolete()
742 list_add_tail(&jeb->list, &c->very_dirty_list); in jffs2_mark_node_obsolete()
745 jeb->offset, jeb->free_size, jeb->dirty_size, in jffs2_mark_node_obsolete()
746 jeb->used_size); in jffs2_mark_node_obsolete()
848 struct jffs2_eraseblock *jeb; in jffs2_thread_should_wake() local
874 list_for_each_entry(jeb, &c->very_dirty_list, list) { in jffs2_thread_should_wake()