Lines Matching refs:lprops

29 static int get_heap_comp_val(struct ubifs_lprops *lprops, int cat)  in get_heap_comp_val()  argument
33 return lprops->free; in get_heap_comp_val()
35 return lprops->free + lprops->dirty; in get_heap_comp_val()
37 return lprops->dirty; in get_heap_comp_val()
54 struct ubifs_lprops *lprops, int cat) in move_up_lpt_heap() argument
58 hpos = lprops->hpos; in move_up_lpt_heap()
61 val1 = get_heap_comp_val(lprops, cat); in move_up_lpt_heap()
72 heap->arr[ppos] = lprops; in move_up_lpt_heap()
73 lprops->hpos = ppos; in move_up_lpt_heap()
91 struct ubifs_lprops *lprops, int hpos, int cat) in adjust_lpt_heap() argument
95 val1 = get_heap_comp_val(lprops, cat); in adjust_lpt_heap()
106 heap->arr[ppos] = lprops; in adjust_lpt_heap()
107 lprops->hpos = ppos; in adjust_lpt_heap()
137 heap->arr[cpos] = lprops; in adjust_lpt_heap()
138 lprops->hpos = cpos; in adjust_lpt_heap()
151 heap->arr[cpos] = lprops; in adjust_lpt_heap()
152 lprops->hpos = cpos; in adjust_lpt_heap()
169 static int add_to_lpt_heap(struct ubifs_info *c, struct ubifs_lprops *lprops, in add_to_lpt_heap() argument
180 cpos = (((size_t)lprops >> 4) & b) + b; in add_to_lpt_heap()
185 val1 = get_heap_comp_val(lprops, cat); in add_to_lpt_heap()
194 lprops->hpos = cpos; in add_to_lpt_heap()
195 heap->arr[cpos] = lprops; in add_to_lpt_heap()
196 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap()
197 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap()
203 lprops->hpos = heap->cnt++; in add_to_lpt_heap()
204 heap->arr[lprops->hpos] = lprops; in add_to_lpt_heap()
205 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap()
206 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap()
218 struct ubifs_lprops *lprops, int cat) in remove_from_lpt_heap() argument
221 int hpos = lprops->hpos; in remove_from_lpt_heap()
225 ubifs_assert(heap->arr[hpos] == lprops); in remove_from_lpt_heap()
266 void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, in ubifs_add_to_cat() argument
273 if (add_to_lpt_heap(c, lprops, cat)) in ubifs_add_to_cat()
279 list_add(&lprops->list, &c->uncat_list); in ubifs_add_to_cat()
282 list_add(&lprops->list, &c->empty_list); in ubifs_add_to_cat()
285 list_add(&lprops->list, &c->freeable_list); in ubifs_add_to_cat()
289 list_add(&lprops->list, &c->frdi_idx_list); in ubifs_add_to_cat()
295 lprops->flags &= ~LPROPS_CAT_MASK; in ubifs_add_to_cat()
296 lprops->flags |= cat; in ubifs_add_to_cat()
310 struct ubifs_lprops *lprops, int cat) in ubifs_remove_from_cat() argument
316 remove_from_lpt_heap(c, lprops, cat); in ubifs_remove_from_cat()
325 ubifs_assert(!list_empty(&lprops->list)); in ubifs_remove_from_cat()
326 list_del(&lprops->list); in ubifs_remove_from_cat()
378 void ubifs_ensure_cat(struct ubifs_info *c, struct ubifs_lprops *lprops) in ubifs_ensure_cat() argument
380 int cat = lprops->flags & LPROPS_CAT_MASK; in ubifs_ensure_cat()
384 cat = ubifs_categorize_lprops(c, lprops); in ubifs_ensure_cat()
387 ubifs_remove_from_cat(c, lprops, LPROPS_UNCAT); in ubifs_ensure_cat()
388 ubifs_add_to_cat(c, lprops, cat); in ubifs_ensure_cat()
402 const struct ubifs_lprops *lprops) in ubifs_categorize_lprops() argument
404 if (lprops->flags & LPROPS_TAKEN) in ubifs_categorize_lprops()
407 if (lprops->free == c->leb_size) { in ubifs_categorize_lprops()
408 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_categorize_lprops()
412 if (lprops->free + lprops->dirty == c->leb_size) { in ubifs_categorize_lprops()
413 if (lprops->flags & LPROPS_INDEX) in ubifs_categorize_lprops()
419 if (lprops->flags & LPROPS_INDEX) { in ubifs_categorize_lprops()
420 if (lprops->dirty + lprops->free >= c->min_idx_node_sz) in ubifs_categorize_lprops()
423 if (lprops->dirty >= c->dead_wm && in ubifs_categorize_lprops()
424 lprops->dirty > lprops->free) in ubifs_categorize_lprops()
426 if (lprops->free > 0) in ubifs_categorize_lprops()
441 static void change_category(struct ubifs_info *c, struct ubifs_lprops *lprops) in change_category() argument
443 int old_cat = lprops->flags & LPROPS_CAT_MASK; in change_category()
444 int new_cat = ubifs_categorize_lprops(c, lprops); in change_category()
453 adjust_lpt_heap(c, heap, lprops, lprops->hpos, new_cat); in change_category()
455 ubifs_remove_from_cat(c, lprops, old_cat); in change_category()
456 ubifs_add_to_cat(c, lprops, new_cat); in change_category()
495 static int is_lprops_dirty(struct ubifs_info *c, struct ubifs_lprops *lprops) in is_lprops_dirty() argument
500 pos = (lprops->lnum - c->main_first) & (UBIFS_LPT_FANOUT - 1); in is_lprops_dirty()
501 pnode = (struct ubifs_pnode *)container_of(lprops - pos, in is_lprops_dirty()
503 lprops[0]); in is_lprops_dirty()
534 struct ubifs_lprops *lprops = (struct ubifs_lprops *)lp; in ubifs_change_lp() local
537 lprops->lnum, free, dirty, flags); in ubifs_change_lp()
552 if (!is_lprops_dirty(c, lprops)) { in ubifs_change_lp()
553 lprops = ubifs_lpt_lookup_dirty(c, lprops->lnum); in ubifs_change_lp()
554 if (IS_ERR(lprops)) in ubifs_change_lp()
555 return lprops; in ubifs_change_lp()
557 ubifs_assert(lprops == ubifs_lpt_lookup_dirty(c, lprops->lnum)); in ubifs_change_lp()
559 ubifs_assert(!(lprops->free & 7) && !(lprops->dirty & 7)); in ubifs_change_lp()
562 if ((lprops->flags & LPROPS_TAKEN) && lprops->free == c->leb_size) in ubifs_change_lp()
565 if (!(lprops->flags & LPROPS_INDEX)) { in ubifs_change_lp()
568 old_spc = lprops->free + lprops->dirty; in ubifs_change_lp()
579 c->lst.total_free += free - lprops->free; in ubifs_change_lp()
583 if (lprops->free != c->leb_size) in ubifs_change_lp()
585 } else if (lprops->free == c->leb_size) in ubifs_change_lp()
587 lprops->free = free; in ubifs_change_lp()
592 c->lst.total_dirty += dirty - lprops->dirty; in ubifs_change_lp()
593 lprops->dirty = dirty; in ubifs_change_lp()
598 if ((lprops->flags & LPROPS_INDEX)) { in ubifs_change_lp()
603 lprops->flags = flags; in ubifs_change_lp()
606 if (!(lprops->flags & LPROPS_INDEX)) { in ubifs_change_lp()
609 new_spc = lprops->free + lprops->dirty; in ubifs_change_lp()
618 if ((lprops->flags & LPROPS_TAKEN) && lprops->free == c->leb_size) in ubifs_change_lp()
621 change_category(c, lprops); in ubifs_change_lp()
624 return lprops; in ubifs_change_lp()
761 struct ubifs_lprops *lprops; in ubifs_fast_find_free() local
770 lprops = heap->arr[0]; in ubifs_fast_find_free()
771 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_free()
772 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_free()
773 return lprops; in ubifs_fast_find_free()
785 struct ubifs_lprops *lprops; in ubifs_fast_find_empty() local
792 lprops = list_entry(c->empty_list.next, struct ubifs_lprops, list); in ubifs_fast_find_empty()
793 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_empty()
794 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_empty()
795 ubifs_assert(lprops->free == c->leb_size); in ubifs_fast_find_empty()
796 return lprops; in ubifs_fast_find_empty()
808 struct ubifs_lprops *lprops; in ubifs_fast_find_freeable() local
815 lprops = list_entry(c->freeable_list.next, struct ubifs_lprops, list); in ubifs_fast_find_freeable()
816 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_freeable()
817 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_freeable()
818 ubifs_assert(lprops->free + lprops->dirty == c->leb_size); in ubifs_fast_find_freeable()
820 return lprops; in ubifs_fast_find_freeable()
832 struct ubifs_lprops *lprops; in ubifs_fast_find_frdi_idx() local
839 lprops = list_entry(c->frdi_idx_list.next, struct ubifs_lprops, list); in ubifs_fast_find_frdi_idx()
840 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_frdi_idx()
841 ubifs_assert((lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_frdi_idx()
842 ubifs_assert(lprops->free + lprops->dirty == c->leb_size); in ubifs_fast_find_frdi_idx()
843 return lprops; in ubifs_fast_find_frdi_idx()
858 struct ubifs_lprops *lprops; in dbg_check_cats() local
865 list_for_each_entry(lprops, &c->empty_list, list) { in dbg_check_cats()
866 if (lprops->free != c->leb_size) { in dbg_check_cats()
868 lprops->lnum, lprops->free, lprops->dirty, in dbg_check_cats()
869 lprops->flags); in dbg_check_cats()
872 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
874 lprops->lnum, lprops->free, lprops->dirty, in dbg_check_cats()
875 lprops->flags); in dbg_check_cats()
881 list_for_each_entry(lprops, &c->freeable_list, list) { in dbg_check_cats()
882 if (lprops->free + lprops->dirty != c->leb_size) { in dbg_check_cats()
884 lprops->lnum, lprops->free, lprops->dirty, in dbg_check_cats()
885 lprops->flags); in dbg_check_cats()
888 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
890 lprops->lnum, lprops->free, lprops->dirty, in dbg_check_cats()
891 lprops->flags); in dbg_check_cats()
911 list_for_each_entry(lprops, &c->frdi_idx_list, list) { in dbg_check_cats()
912 if (lprops->free + lprops->dirty != c->leb_size) { in dbg_check_cats()
914 lprops->lnum, lprops->free, lprops->dirty, in dbg_check_cats()
915 lprops->flags); in dbg_check_cats()
918 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
920 lprops->lnum, lprops->free, lprops->dirty, in dbg_check_cats()
921 lprops->flags); in dbg_check_cats()
924 if (!(lprops->flags & LPROPS_INDEX)) { in dbg_check_cats()
926 lprops->lnum, lprops->free, lprops->dirty, in dbg_check_cats()
927 lprops->flags); in dbg_check_cats()
936 lprops = heap->arr[i]; in dbg_check_cats()
937 if (!lprops) { in dbg_check_cats()
941 if (lprops->hpos != i) { in dbg_check_cats()
945 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
964 struct ubifs_lprops *lprops = heap->arr[i]; in dbg_check_heap() local
968 if ((lprops->flags & LPROPS_CAT_MASK) != cat) { in dbg_check_heap()
972 if (lprops->hpos != i) { in dbg_check_heap()
976 lp = ubifs_lpt_lookup(c, lprops->lnum); in dbg_check_heap()
981 if (lprops != lp) { in dbg_check_heap()
983 (size_t)lprops, (size_t)lp, lprops->lnum, in dbg_check_heap()
990 if (lp == lprops) { in dbg_check_heap()
994 if (lp->lnum == lprops->lnum) { in dbg_check_heap()
1058 struct ubifs_lprops *lprops; in scan_check_cb() local
1061 list_for_each_entry(lprops, list, list) { in scan_check_cb()
1062 if (lprops == lp) { in scan_check_cb()