Lines Matching refs:heap
53 static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in move_up_lpt_heap() argument
66 val2 = get_heap_comp_val(heap->arr[ppos], cat); in move_up_lpt_heap()
70 heap->arr[ppos]->hpos = hpos; in move_up_lpt_heap()
71 heap->arr[hpos] = heap->arr[ppos]; in move_up_lpt_heap()
72 heap->arr[ppos] = lprops; in move_up_lpt_heap()
90 static void adjust_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, in adjust_lpt_heap() argument
100 val2 = get_heap_comp_val(heap->arr[ppos], cat); in adjust_lpt_heap()
104 heap->arr[ppos]->hpos = hpos; in adjust_lpt_heap()
105 heap->arr[hpos] = heap->arr[ppos]; in adjust_lpt_heap()
106 heap->arr[ppos] = lprops; in adjust_lpt_heap()
112 val2 = get_heap_comp_val(heap->arr[ppos], cat); in adjust_lpt_heap()
124 if (cpos >= heap->cnt) in adjust_lpt_heap()
126 val2 = get_heap_comp_val(heap->arr[cpos], cat); in adjust_lpt_heap()
129 if (cpos + 1 < heap->cnt) { in adjust_lpt_heap()
130 val3 = get_heap_comp_val(heap->arr[cpos + 1], in adjust_lpt_heap()
135 heap->arr[cpos]->hpos = hpos; in adjust_lpt_heap()
136 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap()
137 heap->arr[cpos] = lprops; in adjust_lpt_heap()
144 if (cpos >= heap->cnt) in adjust_lpt_heap()
146 val3 = get_heap_comp_val(heap->arr[cpos], cat); in adjust_lpt_heap()
149 heap->arr[cpos]->hpos = hpos; in adjust_lpt_heap()
150 heap->arr[hpos] = heap->arr[cpos]; in adjust_lpt_heap()
151 heap->arr[cpos] = lprops; in adjust_lpt_heap()
172 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in add_to_lpt_heap() local
174 if (heap->cnt >= heap->max_cnt) { in add_to_lpt_heap()
183 ubifs_assert(cpos < heap->cnt); in add_to_lpt_heap()
186 val2 = get_heap_comp_val(heap->arr[cpos], cat); in add_to_lpt_heap()
190 lp = heap->arr[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()
200 dbg_check_heap(c, heap, cat, -1); 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()
220 struct ubifs_lpt_heap *heap; in remove_from_lpt_heap() local
223 heap = &c->lpt_heap[cat - 1]; in remove_from_lpt_heap()
224 ubifs_assert(hpos >= 0 && hpos < heap->cnt); in remove_from_lpt_heap()
225 ubifs_assert(heap->arr[hpos] == lprops); in remove_from_lpt_heap()
226 heap->cnt -= 1; in remove_from_lpt_heap()
227 if (hpos < heap->cnt) { in remove_from_lpt_heap()
228 heap->arr[hpos] = heap->arr[heap->cnt]; in remove_from_lpt_heap()
229 heap->arr[hpos]->hpos = hpos; in remove_from_lpt_heap()
230 adjust_lpt_heap(c, heap, heap->arr[hpos], hpos, cat); in remove_from_lpt_heap()
232 dbg_check_heap(c, heap, cat, -1); in remove_from_lpt_heap()
251 struct ubifs_lpt_heap *heap; in lpt_heap_replace() local
254 heap = &c->lpt_heap[cat - 1]; in lpt_heap_replace()
255 heap->arr[hpos] = new_lprops; in lpt_heap_replace()
447 struct ubifs_lpt_heap *heap; in change_category() local
452 heap = &c->lpt_heap[new_cat - 1]; in change_category()
453 adjust_lpt_heap(c, heap, lprops, lprops->hpos, new_cat); in change_category()
762 struct ubifs_lpt_heap *heap; in ubifs_fast_find_free() local
766 heap = &c->lpt_heap[LPROPS_FREE - 1]; in ubifs_fast_find_free()
767 if (heap->cnt == 0) in ubifs_fast_find_free()
770 lprops = heap->arr[0]; in ubifs_fast_find_free()
933 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in dbg_check_cats() local
935 for (i = 0; i < heap->cnt; i++) { in dbg_check_cats()
936 lprops = heap->arr[i]; in dbg_check_cats()
955 void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, in dbg_check_heap() argument
963 for (i = 0; i < heap->cnt; i++) { in dbg_check_heap()
964 struct ubifs_lprops *lprops = heap->arr[i]; in dbg_check_heap()
989 lp = heap->arr[j]; in dbg_check_heap()
1004 ubifs_dump_heap(c, heap, cat); in dbg_check_heap()
1076 struct ubifs_lpt_heap *heap = &c->lpt_heap[cat - 1]; in scan_check_cb() local
1078 if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) || in scan_check_cb()
1079 lp != heap->arr[lp->hpos]) { in scan_check_cb()