Lines Matching refs:heap

50 static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap,  in move_up_lpt_heap()  argument
63 val2 = get_heap_comp_val(heap->arr[ppos], cat); in move_up_lpt_heap()
67 heap->arr[ppos]->hpos = hpos; in move_up_lpt_heap()
68 heap->arr[hpos] = heap->arr[ppos]; in move_up_lpt_heap()
69 heap->arr[ppos] = lprops; in move_up_lpt_heap()
87 static void adjust_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in adjust_lpt_heap() argument
97 val2 = get_heap_comp_val(heap->arr[ppos], cat); in adjust_lpt_heap()
101 heap->arr[ppos]->hpos = hpos; in adjust_lpt_heap()
102 heap->arr[hpos] = heap->arr[ppos]; in adjust_lpt_heap()
103 heap->arr[ppos] = lprops; in adjust_lpt_heap()
109 val2 = get_heap_comp_val(heap->arr[ppos], cat); in adjust_lpt_heap()
121 if (cpos >= heap->cnt) in adjust_lpt_heap()
123 val2 = get_heap_comp_val(heap->arr[cpos], cat); in adjust_lpt_heap()
126 if (cpos + 1 < heap->cnt) { in adjust_lpt_heap()
127 val3 = get_heap_comp_val(heap->arr[cpos + 1], in adjust_lpt_heap()
132 heap->arr[cpos]->hpos = hpos; in adjust_lpt_heap()
133 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap()
134 heap->arr[cpos] = lprops; in adjust_lpt_heap()
141 if (cpos >= heap->cnt) in adjust_lpt_heap()
143 val3 = get_heap_comp_val(heap->arr[cpos], cat); in adjust_lpt_heap()
146 heap->arr[cpos]->hpos = hpos; in adjust_lpt_heap()
147 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap()
148 heap->arr[cpos] = lprops; in adjust_lpt_heap()
169 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in add_to_lpt_heap() local
171 if (heap->cnt >= heap->max_cnt) { in add_to_lpt_heap()
180 ubifs_assert(c, cpos < heap->cnt); in add_to_lpt_heap()
183 val2 = get_heap_comp_val(heap->arr[cpos], cat); in add_to_lpt_heap()
187 lp = heap->arr[cpos]; in add_to_lpt_heap()
192 heap->arr[cpos] = lprops; in add_to_lpt_heap()
193 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap()
194 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap()
197 dbg_check_heap(c, heap, cat, -1); in add_to_lpt_heap()
200 lprops->hpos = heap->cnt++; in add_to_lpt_heap()
201 heap->arr[lprops->hpos] = lprops; in add_to_lpt_heap()
202 move_up_lpt_heap(c, heap, lprops, cat); in add_to_lpt_heap()
203 dbg_check_heap(c, heap, cat, lprops->hpos); in add_to_lpt_heap()
217 struct ubifs_lpt_heap *heap; in remove_from_lpt_heap() local
220 heap = &c->lpt_heap[cat - 1]; in remove_from_lpt_heap()
221 ubifs_assert(c, hpos >= 0 && hpos < heap->cnt); in remove_from_lpt_heap()
222 ubifs_assert(c, heap->arr[hpos] == lprops); in remove_from_lpt_heap()
223 heap->cnt -= 1; in remove_from_lpt_heap()
224 if (hpos < heap->cnt) { in remove_from_lpt_heap()
225 heap->arr[hpos] = heap->arr[heap->cnt]; in remove_from_lpt_heap()
226 heap->arr[hpos]->hpos = hpos; in remove_from_lpt_heap()
227 adjust_lpt_heap(c, heap, heap->arr[hpos], hpos, cat); in remove_from_lpt_heap()
229 dbg_check_heap(c, heap, cat, -1); in remove_from_lpt_heap()
246 struct ubifs_lpt_heap *heap; in lpt_heap_replace() local
249 heap = &c->lpt_heap[cat - 1]; in lpt_heap_replace()
250 heap->arr[hpos] = new_lprops; in lpt_heap_replace()
442 struct ubifs_lpt_heap *heap; in change_category() local
447 heap = &c->lpt_heap[new_cat - 1]; in change_category()
448 adjust_lpt_heap(c, heap, lprops, lprops->hpos, new_cat); in change_category()
757 struct ubifs_lpt_heap *heap; in ubifs_fast_find_free() local
761 heap = &c->lpt_heap[LPROPS_FREE - 1]; in ubifs_fast_find_free()
762 if (heap->cnt == 0) in ubifs_fast_find_free()
765 lprops = heap->arr[0]; in ubifs_fast_find_free()
928 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in dbg_check_cats() local
930 for (i = 0; i < heap->cnt; i++) { in dbg_check_cats()
931 lprops = heap->arr[i]; in dbg_check_cats()
950 void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, in dbg_check_heap() argument
958 for (i = 0; i < heap->cnt; i++) { in dbg_check_heap()
959 struct ubifs_lprops *lprops = heap->arr[i]; in dbg_check_heap()
984 lp = heap->arr[j]; in dbg_check_heap()
999 ubifs_dump_heap(c, heap, cat); in dbg_check_heap()
1071 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in scan_check_cb() local
1073 if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) || in scan_check_cb()
1074 lp != heap->arr[lp->hpos]) { in scan_check_cb()