/* New entries to a heap are added at the bottom and then moved up until the parent's value is greater. In the case of LPT's category heaps, the value is either the amount of free space or the amount of dirty space, depending on the category.  */
static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, struct ubifs_lprops *lprops, int cat)
/* New entries to a heap are added at the bottom and then moved up until the parent's value is greater. In the case of LPT's category heaps, the value is either the amount of free space or the amount of dirty space, depending on the category.  */
static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, struct ubifs_lprops *lprops, int cat)
{
	int val1, val2, hpos;
	hpos = lprops->hpos;
	if (!hpos)
		return;
	val1 = get_heap_comp_val(lprops, cat);
	do {
		int ppos = (hpos - 1) / 2;
		val2 = get_heap_comp_val(heap->arr[ppos], cat);
		if (val2 >= val1)
			return;
		heap->arr[ppos]->hpos = hpos;
		heap->arr[hpos] = heap->arr[ppos];
		heap->arr[ppos] = lprops;
		lprops->hpos = ppos;
		hpos = ppos;
	} while (hpos);
}