Lines Matching refs:blk
47 rh_block_t *block, *blk; in grow() local
73 for (i = 0, blk = block; i < info->max_blocks; i++, blk++) in grow()
74 fixup(blks, blke, delta, &blk->list); in grow()
91 blk = block + info->max_blocks - new_blocks; in grow()
92 for (i = 0; i < new_blocks; i++, blk++) in grow()
93 list_add(&blk->list, &info->empty_list); in grow()
123 rh_block_t *blk; in get_slot() local
133 blk = list_entry(info->empty_list.next, rh_block_t, list); in get_slot()
134 list_del_init(&blk->list); in get_slot()
138 blk->start = 0; in get_slot()
139 blk->size = 0; in get_slot()
140 blk->owner = NULL; in get_slot()
142 return blk; in get_slot()
145 static inline void release_slot(rh_info_t * info, rh_block_t * blk) in release_slot() argument
147 list_add(&blk->list, &info->empty_list); in release_slot()
153 rh_block_t *blk; in attach_free_block() local
173 blk = list_entry(l, rh_block_t, list); in attach_free_block()
175 bs = blk->start; in attach_free_block()
176 be = bs + blk->size; in attach_free_block()
179 next = blk; in attach_free_block()
182 before = blk; in attach_free_block()
185 after = blk; in attach_free_block()
234 rh_block_t *blk; in attach_taken_block() local
239 blk = list_entry(l, rh_block_t, list); in attach_taken_block()
240 if (blk->start > blkn->start) { in attach_taken_block()
241 list_add_tail(&blkn->list, &blk->list); in attach_taken_block()
304 rh_block_t *blk; in rh_init() local
323 for (i = 0, blk = block; i < max_blocks; i++, blk++) in rh_init()
324 list_add(&blk->list, &info->empty_list); in rh_init()
331 rh_block_t *blk; in rh_attach_region() local
358 blk = get_slot(info); in rh_attach_region()
359 blk->start = start; in rh_attach_region()
360 blk->size = size; in rh_attach_region()
361 blk->owner = NULL; in rh_attach_region()
363 attach_free_block(info, blk); in rh_attach_region()
373 rh_block_t *blk, *newblk; in rh_detach_region() local
394 blk = NULL; in rh_detach_region()
396 blk = list_entry(l, rh_block_t, list); in rh_detach_region()
398 bs = blk->start; in rh_detach_region()
399 be = blk->start + blk->size; in rh_detach_region()
402 blk = NULL; in rh_detach_region()
405 if (blk == NULL) in rh_detach_region()
411 list_del(&blk->list); in rh_detach_region()
412 release_slot(info, blk); in rh_detach_region()
419 blk->start += size; in rh_detach_region()
420 blk->size -= size; in rh_detach_region()
424 blk->size = s - bs; in rh_detach_region()
431 list_add(&newblk->list, &blk->list); in rh_detach_region()
445 rh_block_t *blk; in rh_alloc_align() local
459 blk = NULL; in rh_alloc_align()
461 blk = list_entry(l, rh_block_t, list); in rh_alloc_align()
462 if (size <= blk->size) { in rh_alloc_align()
463 start = (blk->start + alignment - 1) & ~(alignment - 1); in rh_alloc_align()
464 if (start + size <= blk->start + blk->size) in rh_alloc_align()
467 blk = NULL; in rh_alloc_align()
470 if (blk == NULL) in rh_alloc_align()
474 if (blk->size == size) { in rh_alloc_align()
476 list_del(&blk->list); in rh_alloc_align()
477 newblk = blk; in rh_alloc_align()
481 sp_size = start - blk->start; in rh_alloc_align()
486 spblk->start = blk->start; in rh_alloc_align()
489 list_add(&spblk->list, blk->list.prev); in rh_alloc_align()
497 blk->start = start + size; in rh_alloc_align()
498 blk->size -= sp_size + size; in rh_alloc_align()
500 if (blk->size == 0) { in rh_alloc_align()
501 list_del(&blk->list); in rh_alloc_align()
502 release_slot(info, blk); in rh_alloc_align()
530 rh_block_t *blk, *newblk1, *newblk2; in rh_alloc_fixed() local
551 blk = NULL; in rh_alloc_fixed()
553 blk = list_entry(l, rh_block_t, list); in rh_alloc_fixed()
555 bs = blk->start; in rh_alloc_fixed()
556 be = blk->start + blk->size; in rh_alloc_fixed()
559 blk = NULL; in rh_alloc_fixed()
562 if (blk == NULL) in rh_alloc_fixed()
568 list_del(&blk->list); in rh_alloc_fixed()
569 blk->owner = owner; in rh_alloc_fixed()
571 start = blk->start; in rh_alloc_fixed()
572 attach_taken_block(info, blk); in rh_alloc_fixed()
581 blk->start += size; in rh_alloc_fixed()
582 blk->size -= size; in rh_alloc_fixed()
586 blk->size = s - bs; in rh_alloc_fixed()
593 list_add(&newblk2->list, &blk->list); in rh_alloc_fixed()
614 rh_block_t *blk, *blk2; in rh_free() local
619 blk = NULL; in rh_free()
624 blk = blk2; in rh_free()
627 if (blk == NULL || start > (blk->start + blk->size)) in rh_free()
631 list_del(&blk->list); in rh_free()
634 size = blk->size; in rh_free()
635 attach_free_block(info, blk); in rh_free()
643 rh_block_t *blk; in rh_get_stats() local
665 blk = list_entry(l, rh_block_t, list); in rh_get_stats()
667 stats->start = blk->start; in rh_get_stats()
668 stats->size = blk->size; in rh_get_stats()
669 stats->owner = blk->owner; in rh_get_stats()
681 rh_block_t *blk, *blk2; in rh_set_owner() local
686 blk = NULL; in rh_set_owner()
691 blk = blk2; in rh_set_owner()
694 if (blk == NULL || start > (blk->start + blk->size)) in rh_set_owner()
697 blk->owner = owner; in rh_set_owner()
698 size = blk->size; in rh_set_owner()
740 void rh_dump_blk(rh_info_t * info, rh_block_t * blk) in rh_dump_blk() argument
744 blk, blk->start, blk->start + blk->size, blk->size); in rh_dump_blk()