Lines Matching refs:block
32 struct ct_vm_block *block = NULL, *entry; in get_vm_block() local
55 block = entry; in get_vm_block()
59 block = kzalloc(sizeof(*block), GFP_KERNEL); in get_vm_block()
60 if (!block) in get_vm_block()
63 block->addr = entry->addr; in get_vm_block()
64 block->size = size; in get_vm_block()
65 list_add(&block->list, &vm->used); in get_vm_block()
72 return block; in get_vm_block()
75 static void put_vm_block(struct ct_vm *vm, struct ct_vm_block *block) in put_vm_block() argument
80 block->size = CT_PAGE_ALIGN(block->size); in put_vm_block()
83 list_del(&block->list); in put_vm_block()
84 vm->size += block->size; in put_vm_block()
88 if (entry->addr >= (block->addr + block->size)) in put_vm_block()
92 list_add_tail(&block->list, &vm->unused); in put_vm_block()
93 entry = block; in put_vm_block()
95 if ((block->addr + block->size) == entry->addr) { in put_vm_block()
96 entry->addr = block->addr; in put_vm_block()
97 entry->size += block->size; in put_vm_block()
98 kfree(block); in put_vm_block()
100 __list_add(&block->list, pos->prev, pos); in put_vm_block()
101 entry = block; in put_vm_block()
126 struct ct_vm_block *block; in ct_vm_map() local
132 block = get_vm_block(vm, size, atc); in ct_vm_map()
133 if (block == NULL) { in ct_vm_map()
140 pte_start = (block->addr >> CT_PAGE_SHIFT); in ct_vm_map()
141 pages = block->size >> CT_PAGE_SHIFT; in ct_vm_map()
148 block->size = size; in ct_vm_map()
149 return block; in ct_vm_map()
152 static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block) in ct_vm_unmap() argument
155 put_vm_block(vm, block); in ct_vm_unmap()
172 struct ct_vm_block *block; in ct_vm_create() local
202 block = kzalloc(sizeof(*block), GFP_KERNEL); in ct_vm_create()
203 if (NULL != block) { in ct_vm_create()
204 block->addr = 0; in ct_vm_create()
205 block->size = vm->size; in ct_vm_create()
206 list_add(&block->list, &vm->unused); in ct_vm_create()