Lines Matching defs:cache
5 * Don't allow the cache to grow beyond this size.
13 static inline bool io_alloc_cache_put(struct io_alloc_cache *cache,
16 if (cache->nr_cached < cache->max_cached) {
17 cache->nr_cached++;
18 wq_stack_add_head(&entry->node, &cache->list);
25 static inline bool io_alloc_cache_empty(struct io_alloc_cache *cache)
27 return !cache->list.next;
30 static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *cache)
32 if (cache->list.next) {
35 entry = container_of(cache->list.next, struct io_cache_entry, node);
36 kasan_mempool_unpoison_object(entry, cache->elem_size);
37 cache->list.next = cache->list.next->next;
38 cache->nr_cached--;
45 static inline void io_alloc_cache_init(struct io_alloc_cache *cache,
48 cache->list.next = NULL;
49 cache->nr_cached = 0;
50 cache->max_cached = max_nr;
51 cache->elem_size = size;
54 static inline void io_alloc_cache_free(struct io_alloc_cache *cache,
58 struct io_cache_entry *entry = io_alloc_cache_get(cache);
64 cache->nr_cached = 0;