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 #include "rcu_pending.h"
6 
7 struct btree_key_cache {
8 	struct rhashtable	table;
9 	bool			table_init_done;
10 
11 	struct shrinker		*shrink;
12 	unsigned		shrink_iter;
13 
14 	/* 0: non pcpu reader locks, 1: pcpu reader locks */
15 	struct rcu_pending	pending[2];
16 	size_t __percpu		*nr_pending;
17 
18 	atomic_long_t		nr_keys;
19 	atomic_long_t		nr_dirty;
20 
21 	/* shrinker stats */
22 	unsigned long		requested_to_free;
23 	unsigned long		freed;
24 	unsigned long		skipped_dirty;
25 	unsigned long		skipped_accessed;
26 	unsigned long		skipped_lock_fail;
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