#include "bcachefs.h"
#include "btree_cache.h"
#include "btree_iter.h"
#include "btree_key_cache.h"
#include "btree_locking.h"
#include "btree_update.h"
#include "errcode.h"
#include "error.h"
#include "journal.h"
#include "journal_reclaim.h"
#include "trace.h"
#include <linux/sched/mm.h>
static inline bool btree_uses_pcpu_readers(enum btree_id id)
{ … }
static struct kmem_cache *bch2_key_cache;
static int bch2_btree_key_cache_cmp_fn(struct rhashtable_compare_arg *arg,
const void *obj)
{ … }
static const struct rhashtable_params bch2_btree_key_cache_params = …;
static inline void btree_path_cached_set(struct btree_trans *trans, struct btree_path *path,
struct bkey_cached *ck,
enum btree_node_locked_type lock_held)
{ … }
__flatten
inline struct bkey_cached *
bch2_btree_key_cache_find(struct bch_fs *c, enum btree_id btree_id, struct bpos pos)
{ … }
static bool bkey_cached_lock_for_evict(struct bkey_cached *ck)
{ … }
static void bkey_cached_evict(struct btree_key_cache *c,
struct bkey_cached *ck)
{ … }
static void bkey_cached_free(struct btree_key_cache *bc,
struct bkey_cached *ck)
{ … }
#ifdef __KERNEL__
static void __bkey_cached_move_to_freelist_ordered(struct btree_key_cache *bc,
struct bkey_cached *ck)
{ … }
#endif
static void bkey_cached_move_to_freelist(struct btree_key_cache *bc,
struct bkey_cached *ck)
{ … }
static void bkey_cached_free_fast(struct btree_key_cache *bc,
struct bkey_cached *ck)
{ … }
static struct bkey_cached *__bkey_cached_alloc(unsigned key_u64s, gfp_t gfp)
{ … }
static struct bkey_cached *
bkey_cached_alloc(struct btree_trans *trans, struct btree_path *path, unsigned key_u64s)
{ … }
static struct bkey_cached *
bkey_cached_reuse(struct btree_key_cache *c)
{ … }
static int btree_key_cache_create(struct btree_trans *trans, struct btree_path *path,
struct bkey_s_c k)
{ … }
static noinline int btree_key_cache_fill(struct btree_trans *trans,
struct btree_path *ck_path,
unsigned flags)
{ … }
static inline int btree_path_traverse_cached_fast(struct btree_trans *trans,
struct btree_path *path)
{ … }
int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path *path,
unsigned flags)
{ … }
static int btree_key_cache_flush_pos(struct btree_trans *trans,
struct bkey_cached_key key,
u64 journal_seq,
unsigned commit_flags,
bool evict)
{ … }
int bch2_btree_key_cache_journal_flush(struct journal *j,
struct journal_entry_pin *pin, u64 seq)
{ … }
bool bch2_btree_insert_key_cached(struct btree_trans *trans,
unsigned flags,
struct btree_insert_entry *insert_entry)
{ … }
void bch2_btree_key_cache_drop(struct btree_trans *trans,
struct btree_path *path)
{ … }
static unsigned long bch2_btree_key_cache_scan(struct shrinker *shrink,
struct shrink_control *sc)
{ … }
static unsigned long bch2_btree_key_cache_count(struct shrinker *shrink,
struct shrink_control *sc)
{ … }
void bch2_fs_btree_key_cache_exit(struct btree_key_cache *bc)
{ … }
void bch2_fs_btree_key_cache_init_early(struct btree_key_cache *c)
{ … }
int bch2_fs_btree_key_cache_init(struct btree_key_cache *bc)
{ … }
void bch2_btree_key_cache_to_text(struct printbuf *out, struct btree_key_cache *bc)
{ … }
void bch2_btree_key_cache_exit(void)
{ … }
int __init bch2_btree_key_cache_init(void)
{ … }