1 | /* SPDX-License-Identifier: GPL-2.0 */ |
---|---|
2 | #ifndef _BCACHEFS_BTREE_KEY_CACHE_TYPES_H |
3 | #define _BCACHEFS_BTREE_KEY_CACHE_TYPES_H |
4 | |
5 | struct btree_key_cache_freelist { |
6 | struct bkey_cached *objs[16]; |
7 | unsigned nr; |
8 | }; |
9 | |
10 | struct btree_key_cache { |
11 | struct mutex lock; |
12 | struct rhashtable table; |
13 | bool table_init_done; |
14 | |
15 | struct list_head freed_pcpu; |
16 | size_t nr_freed_pcpu; |
17 | struct list_head freed_nonpcpu; |
18 | size_t nr_freed_nonpcpu; |
19 | |
20 | struct shrinker *shrink; |
21 | unsigned shrink_iter; |
22 | struct btree_key_cache_freelist __percpu *pcpu_freed; |
23 | |
24 | atomic_long_t nr_freed; |
25 | atomic_long_t nr_keys; |
26 | atomic_long_t nr_dirty; |
27 | }; |
28 | |
29 | struct bkey_cached_key { |
30 | u32 btree_id; |
31 | struct bpos pos; |
32 | } __packed __aligned(4); |
33 | |
34 | #endif /* _BCACHEFS_BTREE_KEY_CACHE_TYPES_H */ |
35 |