diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-14 05:44:14 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-14 05:44:14 +0300 |
commit | 1bd5bcc9f5eef968ed021d72b14a157be7abdb49 (patch) | |
tree | d66b7b25671f41fe5b8bbf9533066a7dfece980d /fs/bcachefs/btree_key_cache_types.h | |
parent | 4d6128dca6d940015fe2aa383ec1a0eeb9632f08 (diff) | |
download | linux-1bd5bcc9f5eef968ed021d72b14a157be7abdb49.tar.xz |
bcachefs: Split out btree_key_cache_types.h
More consistent organization.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_key_cache_types.h')
-rw-r--r-- | fs/bcachefs/btree_key_cache_types.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_key_cache_types.h b/fs/bcachefs/btree_key_cache_types.h new file mode 100644 index 000000000000..0f967808d766 --- /dev/null +++ b/fs/bcachefs/btree_key_cache_types.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _BCACHEFS_BTREE_KEY_CACHE_TYPES_H +#define _BCACHEFS_BTREE_KEY_CACHE_TYPES_H + +struct btree_key_cache_freelist { + struct bkey_cached *objs[16]; + unsigned nr; +}; + +struct btree_key_cache { + struct mutex lock; + struct rhashtable table; + bool table_init_done; + struct list_head freed_pcpu; + struct list_head freed_nonpcpu; + struct shrinker *shrink; + unsigned shrink_iter; + struct btree_key_cache_freelist __percpu *pcpu_freed; + + atomic_long_t nr_freed; + atomic_long_t nr_keys; + atomic_long_t nr_dirty; +}; + +struct bkey_cached_key { + u32 btree_id; + struct bpos pos; +} __packed __aligned(4); + +#endif /* _BCACHEFS_BTREE_KEY_CACHE_TYPES_H */ |