Lines Matching refs:heap

62 static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap,  in move_up_lpt_heap()  argument
75 val2 = get_heap_comp_val(heap->arr[ppos], cat); in move_up_lpt_heap()
79 heap->arr[ppos]->hpos = hpos; in move_up_lpt_heap()
80 heap->arr[hpos] = heap->arr[ppos]; in move_up_lpt_heap()
81 heap->arr[ppos] = lprops; in move_up_lpt_heap()
99 static void adjust_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in adjust_lpt_heap() argument
109 val2 = get_heap_comp_val(heap->arr[ppos], cat); in adjust_lpt_heap()
113 heap->arr[ppos]->hpos = hpos; in adjust_lpt_heap()
114 heap->arr[hpos] = heap->arr[ppos]; in adjust_lpt_heap()
115 heap->arr[ppos] = lprops; in adjust_lpt_heap()
121 val2 = get_heap_comp_val(heap->arr[ppos], cat); in adjust_lpt_heap()
133 if (cpos >= heap->cnt) in adjust_lpt_heap()
135 val2 = get_heap_comp_val(heap->arr[cpos], cat); in adjust_lpt_heap()
138 if (cpos + 1 < heap->cnt) { in adjust_lpt_heap()
139 val3 = get_heap_comp_val(heap->arr[cpos + 1], in adjust_lpt_heap()
144 heap->arr[cpos]->hpos = hpos; in adjust_lpt_heap()
145 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap()
146 heap->arr[cpos] = lprops; in adjust_lpt_heap()
153 if (cpos >= heap->cnt) in adjust_lpt_heap()
155 val3 = get_heap_comp_val(heap->arr[cpos], cat); in adjust_lpt_heap()
158 heap->arr[cpos]->hpos = hpos; in adjust_lpt_heap()
159 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap()
160 heap->arr[cpos] = lprops; in adjust_lpt_heap()
181 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in add_to_lpt_heap() local
183 if (heap->cnt >= heap->max_cnt) { in add_to_lpt_heap()
192 ubifs_assert(c, cpos < heap->cnt); in add_to_lpt_heap()
195 val2 = get_heap_comp_val(heap->arr[cpos], cat); in add_to_lpt_heap()
199 lp = heap->arr[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()
209 dbg_check_heap(c, heap, cat, -1); 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()
229 struct ubifs_lpt_heap *heap; in remove_from_lpt_heap() local
232 heap = &c->lpt_heap[cat - 1]; in remove_from_lpt_heap()
233 ubifs_assert(c, hpos >= 0 && hpos < heap->cnt); in remove_from_lpt_heap()
234 ubifs_assert(c, heap->arr[hpos] == lprops); in remove_from_lpt_heap()
235 heap->cnt -= 1; in remove_from_lpt_heap()
236 if (hpos < heap->cnt) { in remove_from_lpt_heap()
237 heap->arr[hpos] = heap->arr[heap->cnt]; in remove_from_lpt_heap()
238 heap->arr[hpos]->hpos = hpos; in remove_from_lpt_heap()
239 adjust_lpt_heap(c, heap, heap->arr[hpos], hpos, cat); in remove_from_lpt_heap()
241 dbg_check_heap(c, heap, cat, -1); in remove_from_lpt_heap()
258 struct ubifs_lpt_heap *heap; in lpt_heap_replace() local
261 heap = &c->lpt_heap[cat - 1]; in lpt_heap_replace()
262 heap->arr[hpos] = new_lprops; in lpt_heap_replace()
454 struct ubifs_lpt_heap *heap; in change_category() local
459 heap = &c->lpt_heap[new_cat - 1]; in change_category()
460 adjust_lpt_heap(c, heap, lprops, lprops->hpos, new_cat); in change_category()
769 struct ubifs_lpt_heap *heap; in ubifs_fast_find_free() local
773 heap = &c->lpt_heap[LPROPS_FREE - 1]; in ubifs_fast_find_free()
774 if (heap->cnt == 0) in ubifs_fast_find_free()
777 lprops = heap->arr[0]; in ubifs_fast_find_free()
940 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in dbg_check_cats() local
942 for (i = 0; i < heap->cnt; i++) { in dbg_check_cats()
943 lprops = heap->arr[i]; in dbg_check_cats()
962 void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, in dbg_check_heap() argument
970 for (i = 0; i < heap->cnt; i++) { in dbg_check_heap()
971 struct ubifs_lprops *lprops = heap->arr[i]; in dbg_check_heap()
996 lp = heap->arr[j]; in dbg_check_heap()
1011 ubifs_dump_heap(c, heap, cat); in dbg_check_heap()
1083 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in scan_check_cb() local
1085 if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) || in scan_check_cb()
1086 lp != heap->arr[lp->hpos]) { in scan_check_cb()