• Home
  • Raw
  • Download

Lines Matching refs:lprops

38 static int get_heap_comp_val(struct ubifs_lprops *lprops, int cat)  in get_heap_comp_val()  argument
42 return lprops->free; in get_heap_comp_val()
44 return lprops->free + lprops->dirty; in get_heap_comp_val()
46 return lprops->dirty; in get_heap_comp_val()
63 struct ubifs_lprops *lprops, int cat) in move_up_lpt_heap() argument
67 hpos = lprops->hpos; in move_up_lpt_heap()
70 val1 = get_heap_comp_val(lprops, cat); in move_up_lpt_heap()
81 heap->arr[ppos] = lprops; in move_up_lpt_heap()
82 lprops->hpos = ppos; in move_up_lpt_heap()
100 struct ubifs_lprops *lprops, int hpos, int cat) in adjust_lpt_heap() argument
104 val1 = get_heap_comp_val(lprops, cat); in adjust_lpt_heap()
115 heap->arr[ppos] = lprops; in adjust_lpt_heap()
116 lprops->hpos = ppos; in adjust_lpt_heap()
146 heap->arr[cpos] = lprops; in adjust_lpt_heap()
147 lprops->hpos = cpos; in adjust_lpt_heap()
160 heap->arr[cpos] = lprops; in adjust_lpt_heap()
161 lprops->hpos = cpos; in adjust_lpt_heap()
178 static int add_to_lpt_heap(struct ubifs_info *c, struct ubifs_lprops *lprops, in add_to_lpt_heap() argument
189 cpos = (((size_t)lprops >> 4) & b) + b; in add_to_lpt_heap()
194 val1 = get_heap_comp_val(lprops, cat); in add_to_lpt_heap()
203 lprops->hpos = cpos; in add_to_lpt_heap()
204 heap->arr[cpos] = 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()
212 lprops->hpos = heap->cnt++; in add_to_lpt_heap()
213 heap->arr[lprops->hpos] = lprops; in add_to_lpt_heap()
214 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap()
215 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap()
227 struct ubifs_lprops *lprops, int cat) in remove_from_lpt_heap() argument
230 int hpos = lprops->hpos; in remove_from_lpt_heap()
234 ubifs_assert(heap->arr[hpos] == lprops); in remove_from_lpt_heap()
275 void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, in ubifs_add_to_cat() argument
282 if (add_to_lpt_heap(c, lprops, cat)) in ubifs_add_to_cat()
288 list_add(&lprops->list, &c->uncat_list); in ubifs_add_to_cat()
291 list_add(&lprops->list, &c->empty_list); in ubifs_add_to_cat()
294 list_add(&lprops->list, &c->freeable_list); in ubifs_add_to_cat()
298 list_add(&lprops->list, &c->frdi_idx_list); in ubifs_add_to_cat()
304 lprops->flags &= ~LPROPS_CAT_MASK; in ubifs_add_to_cat()
305 lprops->flags |= cat; in ubifs_add_to_cat()
319 struct ubifs_lprops *lprops, int cat) in ubifs_remove_from_cat() argument
325 remove_from_lpt_heap(c, lprops, cat); in ubifs_remove_from_cat()
334 ubifs_assert(!list_empty(&lprops->list)); in ubifs_remove_from_cat()
335 list_del(&lprops->list); in ubifs_remove_from_cat()
387 void ubifs_ensure_cat(struct ubifs_info *c, struct ubifs_lprops *lprops) in ubifs_ensure_cat() argument
389 int cat = lprops->flags & LPROPS_CAT_MASK; in ubifs_ensure_cat()
393 cat = ubifs_categorize_lprops(c, lprops); in ubifs_ensure_cat()
396 ubifs_remove_from_cat(c, lprops, LPROPS_UNCAT); in ubifs_ensure_cat()
397 ubifs_add_to_cat(c, lprops, cat); in ubifs_ensure_cat()
411 const struct ubifs_lprops *lprops) in ubifs_categorize_lprops() argument
413 if (lprops->flags & LPROPS_TAKEN) in ubifs_categorize_lprops()
416 if (lprops->free == c->leb_size) { in ubifs_categorize_lprops()
417 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_categorize_lprops()
421 if (lprops->free + lprops->dirty == c->leb_size) { in ubifs_categorize_lprops()
422 if (lprops->flags & LPROPS_INDEX) in ubifs_categorize_lprops()
428 if (lprops->flags & LPROPS_INDEX) { in ubifs_categorize_lprops()
429 if (lprops->dirty + lprops->free >= c->min_idx_node_sz) in ubifs_categorize_lprops()
432 if (lprops->dirty >= c->dead_wm && in ubifs_categorize_lprops()
433 lprops->dirty > lprops->free) in ubifs_categorize_lprops()
435 if (lprops->free > 0) in ubifs_categorize_lprops()
450 static void change_category(struct ubifs_info *c, struct ubifs_lprops *lprops) in change_category() argument
452 int old_cat = lprops->flags & LPROPS_CAT_MASK; in change_category()
453 int new_cat = ubifs_categorize_lprops(c, lprops); in change_category()
462 adjust_lpt_heap(c, heap, lprops, lprops->hpos, new_cat); in change_category()
464 ubifs_remove_from_cat(c, lprops, old_cat); in change_category()
465 ubifs_add_to_cat(c, lprops, new_cat); in change_category()
504 static int is_lprops_dirty(struct ubifs_info *c, struct ubifs_lprops *lprops) in is_lprops_dirty() argument
509 pos = (lprops->lnum - c->main_first) & (UBIFS_LPT_FANOUT - 1); in is_lprops_dirty()
510 pnode = (struct ubifs_pnode *)container_of(lprops - pos, in is_lprops_dirty()
512 lprops[0]); in is_lprops_dirty()
543 struct ubifs_lprops *lprops = (struct ubifs_lprops *)lp; in ubifs_change_lp() local
546 lprops->lnum, free, dirty, flags); in ubifs_change_lp()
561 if (!is_lprops_dirty(c, lprops)) { in ubifs_change_lp()
562 lprops = ubifs_lpt_lookup_dirty(c, lprops->lnum); in ubifs_change_lp()
563 if (IS_ERR(lprops)) in ubifs_change_lp()
564 return lprops; in ubifs_change_lp()
566 ubifs_assert(lprops == ubifs_lpt_lookup_dirty(c, lprops->lnum)); in ubifs_change_lp()
568 ubifs_assert(!(lprops->free & 7) && !(lprops->dirty & 7)); in ubifs_change_lp()
571 if ((lprops->flags & LPROPS_TAKEN) && lprops->free == c->leb_size) in ubifs_change_lp()
574 if (!(lprops->flags & LPROPS_INDEX)) { in ubifs_change_lp()
577 old_spc = lprops->free + lprops->dirty; in ubifs_change_lp()
588 c->lst.total_free += free - lprops->free; in ubifs_change_lp()
592 if (lprops->free != c->leb_size) in ubifs_change_lp()
594 } else if (lprops->free == c->leb_size) in ubifs_change_lp()
596 lprops->free = free; in ubifs_change_lp()
601 c->lst.total_dirty += dirty - lprops->dirty; in ubifs_change_lp()
602 lprops->dirty = dirty; in ubifs_change_lp()
607 if ((lprops->flags & LPROPS_INDEX)) { in ubifs_change_lp()
612 lprops->flags = flags; in ubifs_change_lp()
615 if (!(lprops->flags & LPROPS_INDEX)) { in ubifs_change_lp()
618 new_spc = lprops->free + lprops->dirty; in ubifs_change_lp()
627 if ((lprops->flags & LPROPS_TAKEN) && lprops->free == c->leb_size) in ubifs_change_lp()
630 change_category(c, lprops); in ubifs_change_lp()
633 return lprops; in ubifs_change_lp()
770 struct ubifs_lprops *lprops; in ubifs_fast_find_free() local
779 lprops = heap->arr[0]; in ubifs_fast_find_free()
780 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_free()
781 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_free()
782 return lprops; in ubifs_fast_find_free()
794 struct ubifs_lprops *lprops; in ubifs_fast_find_empty() local
801 lprops = list_entry(c->empty_list.next, struct ubifs_lprops, list); in ubifs_fast_find_empty()
802 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_empty()
803 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_empty()
804 ubifs_assert(lprops->free == c->leb_size); in ubifs_fast_find_empty()
805 return lprops; in ubifs_fast_find_empty()
817 struct ubifs_lprops *lprops; in ubifs_fast_find_freeable() local
824 lprops = list_entry(c->freeable_list.next, struct ubifs_lprops, list); in ubifs_fast_find_freeable()
825 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_freeable()
826 ubifs_assert(!(lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_freeable()
827 ubifs_assert(lprops->free + lprops->dirty == c->leb_size); in ubifs_fast_find_freeable()
829 return lprops; in ubifs_fast_find_freeable()
841 struct ubifs_lprops *lprops; in ubifs_fast_find_frdi_idx() local
848 lprops = list_entry(c->frdi_idx_list.next, struct ubifs_lprops, list); in ubifs_fast_find_frdi_idx()
849 ubifs_assert(!(lprops->flags & LPROPS_TAKEN)); in ubifs_fast_find_frdi_idx()
850 ubifs_assert((lprops->flags & LPROPS_INDEX)); in ubifs_fast_find_frdi_idx()
851 ubifs_assert(lprops->free + lprops->dirty == c->leb_size); in ubifs_fast_find_frdi_idx()
852 return lprops; in ubifs_fast_find_frdi_idx()
865 struct ubifs_lprops *lprops; in dbg_check_cats() local
872 list_for_each_entry(lprops, &c->empty_list, list) { in dbg_check_cats()
873 if (lprops->free != c->leb_size) { in dbg_check_cats()
875 "(free %d dirty %d flags %d)", lprops->lnum, in dbg_check_cats()
876 lprops->free, lprops->dirty, lprops->flags); in dbg_check_cats()
879 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
881 "(free %d dirty %d flags %d)", lprops->lnum, in dbg_check_cats()
882 lprops->free, lprops->dirty, lprops->flags); in dbg_check_cats()
888 list_for_each_entry(lprops, &c->freeable_list, list) { in dbg_check_cats()
889 if (lprops->free + lprops->dirty != c->leb_size) { in dbg_check_cats()
891 "(free %d dirty %d flags %d)", lprops->lnum, in dbg_check_cats()
892 lprops->free, lprops->dirty, lprops->flags); in dbg_check_cats()
895 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
897 "(free %d dirty %d flags %d)", lprops->lnum, in dbg_check_cats()
898 lprops->free, lprops->dirty, lprops->flags); in dbg_check_cats()
918 list_for_each_entry(lprops, &c->frdi_idx_list, list) { in dbg_check_cats()
919 if (lprops->free + lprops->dirty != c->leb_size) { in dbg_check_cats()
921 "(free %d dirty %d flags %d)", lprops->lnum, in dbg_check_cats()
922 lprops->free, lprops->dirty, lprops->flags); in dbg_check_cats()
925 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
927 "(free %d dirty %d flags %d)", lprops->lnum, in dbg_check_cats()
928 lprops->free, lprops->dirty, lprops->flags); in dbg_check_cats()
931 if (!(lprops->flags & LPROPS_INDEX)) { in dbg_check_cats()
933 "(free %d dirty %d flags %d)", lprops->lnum, in dbg_check_cats()
934 lprops->free, lprops->dirty, lprops->flags); in dbg_check_cats()
943 lprops = heap->arr[i]; in dbg_check_cats()
944 if (!lprops) { in dbg_check_cats()
948 if (lprops->hpos != i) { in dbg_check_cats()
952 if (lprops->flags & LPROPS_TAKEN) { in dbg_check_cats()
971 struct ubifs_lprops *lprops = heap->arr[i]; in dbg_check_heap() local
975 if ((lprops->flags & LPROPS_CAT_MASK) != cat) { in dbg_check_heap()
979 if (lprops->hpos != i) { in dbg_check_heap()
983 lp = ubifs_lpt_lookup(c, lprops->lnum); in dbg_check_heap()
988 if (lprops != lp) { in dbg_check_heap()
990 (size_t)lprops, (size_t)lp, lprops->lnum, in dbg_check_heap()
997 if (lp == lprops) { in dbg_check_heap()
1001 if (lp->lnum == lprops->lnum) { in dbg_check_heap()
1065 struct ubifs_lprops *lprops; in scan_check_cb() local
1068 list_for_each_entry(lprops, list, list) { in scan_check_cb()
1069 if (lprops == lp) { in scan_check_cb()