Lines Matching refs: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);
26 static inline bool io_alloc_cache_empty(struct io_alloc_cache *cache)
28 return !cache->list.next;
31 static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *cache)
33 if (cache->list.next) {
36 entry = container_of(cache->list.next, struct io_cache_entry, node);
37 kasan_unpoison_range(entry, cache->elem_size);
38 cache->list.next = cache->list.next->next;
39 cache->nr_cached--;
46 static inline void io_alloc_cache_init(struct io_alloc_cache *cache,
49 cache->list.next = NULL;
50 cache->nr_cached = 0;
51 cache->max_cached = max_nr;
52 cache->elem_size = size;
55 static inline void io_alloc_cache_free(struct io_alloc_cache *cache,
59 struct io_cache_entry *entry = io_alloc_cache_get(cache);
65 cache->nr_cached = 0;