Lines Matching full:allocator
22 * This is basically a simplified slab allocator.
24 * We don't use the Linux slab allocator because slab does not allow
58 struct yaffs_allocator *allocator = in yaffs_deinit_raw_tnodes() local
59 (struct yaffs_allocator *)dev->allocator; in yaffs_deinit_raw_tnodes()
62 if (!allocator) { in yaffs_deinit_raw_tnodes()
67 while (allocator->alloc_tnode_list) { in yaffs_deinit_raw_tnodes()
68 tmp = allocator->alloc_tnode_list->next; in yaffs_deinit_raw_tnodes()
70 kfree(allocator->alloc_tnode_list->tnodes); in yaffs_deinit_raw_tnodes()
71 kfree(allocator->alloc_tnode_list); in yaffs_deinit_raw_tnodes()
72 allocator->alloc_tnode_list = tmp; in yaffs_deinit_raw_tnodes()
75 allocator->free_tnodes = NULL; in yaffs_deinit_raw_tnodes()
76 allocator->n_free_tnodes = 0; in yaffs_deinit_raw_tnodes()
77 allocator->n_tnodes_created = 0; in yaffs_deinit_raw_tnodes()
82 struct yaffs_allocator *allocator = dev->allocator; in yaffs_init_raw_tnodes() local
84 if (!allocator) { in yaffs_init_raw_tnodes()
89 allocator->alloc_tnode_list = NULL; in yaffs_init_raw_tnodes()
90 allocator->free_tnodes = NULL; in yaffs_init_raw_tnodes()
91 allocator->n_free_tnodes = 0; in yaffs_init_raw_tnodes()
92 allocator->n_tnodes_created = 0; in yaffs_init_raw_tnodes()
97 struct yaffs_allocator *allocator = in yaffs_create_tnodes() local
98 (struct yaffs_allocator *)dev->allocator; in yaffs_create_tnodes()
106 if (!allocator) { in yaffs_create_tnodes()
132 curr->internal[0] = allocator->free_tnodes; in yaffs_create_tnodes()
133 allocator->free_tnodes = (struct yaffs_tnode *)mem; in yaffs_create_tnodes()
135 allocator->n_free_tnodes += n_tnodes; in yaffs_create_tnodes()
136 allocator->n_tnodes_created += n_tnodes; in yaffs_create_tnodes()
149 tnl->next = allocator->alloc_tnode_list; in yaffs_create_tnodes()
150 allocator->alloc_tnode_list = tnl; in yaffs_create_tnodes()
160 struct yaffs_allocator *allocator = in yaffs_alloc_raw_tnode() local
161 (struct yaffs_allocator *)dev->allocator; in yaffs_alloc_raw_tnode()
164 if (!allocator) { in yaffs_alloc_raw_tnode()
170 if (!allocator->free_tnodes) in yaffs_alloc_raw_tnode()
173 if (allocator->free_tnodes) { in yaffs_alloc_raw_tnode()
174 tn = allocator->free_tnodes; in yaffs_alloc_raw_tnode()
175 allocator->free_tnodes = allocator->free_tnodes->internal[0]; in yaffs_alloc_raw_tnode()
176 allocator->n_free_tnodes--; in yaffs_alloc_raw_tnode()
185 struct yaffs_allocator *allocator = dev->allocator; in yaffs_free_raw_tnode() local
187 if (!allocator) { in yaffs_free_raw_tnode()
193 tn->internal[0] = allocator->free_tnodes; in yaffs_free_raw_tnode()
194 allocator->free_tnodes = tn; in yaffs_free_raw_tnode()
195 allocator->n_free_tnodes++; in yaffs_free_raw_tnode()
208 struct yaffs_allocator *allocator = dev->allocator; in yaffs_init_raw_objs() local
210 if (!allocator) { in yaffs_init_raw_objs()
215 allocator->allocated_obj_list = NULL; in yaffs_init_raw_objs()
216 INIT_LIST_HEAD(&allocator->free_objs); in yaffs_init_raw_objs()
217 allocator->n_free_objects = 0; in yaffs_init_raw_objs()
222 struct yaffs_allocator *allocator = dev->allocator; in yaffs_deinit_raw_objs() local
225 if (!allocator) { in yaffs_deinit_raw_objs()
230 while (allocator->allocated_obj_list) { in yaffs_deinit_raw_objs()
231 tmp = allocator->allocated_obj_list->next; in yaffs_deinit_raw_objs()
232 kfree(allocator->allocated_obj_list->objects); in yaffs_deinit_raw_objs()
233 kfree(allocator->allocated_obj_list); in yaffs_deinit_raw_objs()
234 allocator->allocated_obj_list = tmp; in yaffs_deinit_raw_objs()
237 INIT_LIST_HEAD(&allocator->free_objs); in yaffs_deinit_raw_objs()
238 allocator->n_free_objects = 0; in yaffs_deinit_raw_objs()
239 allocator->n_obj_created = 0; in yaffs_deinit_raw_objs()
244 struct yaffs_allocator *allocator = dev->allocator; in yaffs_create_free_objs() local
249 if (!allocator) { in yaffs_create_free_objs()
273 list_add(&new_objs[i].siblings, &allocator->free_objs); in yaffs_create_free_objs()
275 allocator->n_free_objects += n_obj; in yaffs_create_free_objs()
276 allocator->n_obj_created += n_obj; in yaffs_create_free_objs()
281 list->next = allocator->allocated_obj_list; in yaffs_create_free_objs()
282 allocator->allocated_obj_list = list; in yaffs_create_free_objs()
291 struct yaffs_allocator *allocator = dev->allocator; in yaffs_alloc_raw_obj() local
293 if (!allocator) { in yaffs_alloc_raw_obj()
299 if (list_empty(&allocator->free_objs)) in yaffs_alloc_raw_obj()
302 if (!list_empty(&allocator->free_objs)) { in yaffs_alloc_raw_obj()
303 lh = allocator->free_objs.next; in yaffs_alloc_raw_obj()
306 allocator->n_free_objects--; in yaffs_alloc_raw_obj()
315 struct yaffs_allocator *allocator = dev->allocator; in yaffs_free_raw_obj() local
317 if (!allocator) { in yaffs_free_raw_obj()
323 list_add(&obj->siblings, &allocator->free_objs); in yaffs_free_raw_obj()
324 allocator->n_free_objects++; in yaffs_free_raw_obj()
330 if (!dev->allocator) { in yaffs_deinit_raw_tnodes_and_objs()
337 kfree(dev->allocator); in yaffs_deinit_raw_tnodes_and_objs()
338 dev->allocator = NULL; in yaffs_deinit_raw_tnodes_and_objs()
343 struct yaffs_allocator *allocator; in yaffs_init_raw_tnodes_and_objs() local
345 if (dev->allocator) { in yaffs_init_raw_tnodes_and_objs()
350 allocator = kmalloc(sizeof(struct yaffs_allocator), GFP_NOFS); in yaffs_init_raw_tnodes_and_objs()
351 if (allocator) { in yaffs_init_raw_tnodes_and_objs()
352 dev->allocator = allocator; in yaffs_init_raw_tnodes_and_objs()