Lines Matching refs:ep
330 static int epool_init(struct entry_pool *ep, unsigned nr_entries) in epool_init() argument
334 ep->entries = vzalloc(sizeof(struct entry) * nr_entries); in epool_init()
335 if (!ep->entries) in epool_init()
338 ep->entries_end = ep->entries + nr_entries; in epool_init()
340 INIT_LIST_HEAD(&ep->free); in epool_init()
342 list_add(&ep->entries[i].list, &ep->free); in epool_init()
344 ep->nr_allocated = 0; in epool_init()
349 static void epool_exit(struct entry_pool *ep) in epool_exit() argument
351 vfree(ep->entries); in epool_exit()
354 static struct entry *alloc_entry(struct entry_pool *ep) in alloc_entry() argument
358 if (list_empty(&ep->free)) in alloc_entry()
361 e = list_entry(list_pop(&ep->free), struct entry, list); in alloc_entry()
364 ep->nr_allocated++; in alloc_entry()
372 static struct entry *alloc_particular_entry(struct entry_pool *ep, dm_cblock_t cblock) in alloc_particular_entry() argument
374 struct entry *e = ep->entries + from_cblock(cblock); in alloc_particular_entry()
378 ep->nr_allocated++; in alloc_particular_entry()
383 static void free_entry(struct entry_pool *ep, struct entry *e) in free_entry() argument
385 BUG_ON(!ep->nr_allocated); in free_entry()
386 ep->nr_allocated--; in free_entry()
388 list_add(&e->list, &ep->free); in free_entry()
394 static struct entry *epool_find(struct entry_pool *ep, dm_cblock_t cblock) in epool_find() argument
396 struct entry *e = ep->entries + from_cblock(cblock); in epool_find()
400 static bool epool_empty(struct entry_pool *ep) in epool_empty() argument
402 return list_empty(&ep->free); in epool_empty()
405 static bool in_pool(struct entry_pool *ep, struct entry *e) in in_pool() argument
407 return e >= ep->entries && e < ep->entries_end; in in_pool()
410 static dm_cblock_t infer_cblock(struct entry_pool *ep, struct entry *e) in infer_cblock() argument
412 return to_cblock(e - ep->entries); in infer_cblock()