linux/fs/bcachefs/btree_types.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _BCACHEFS_BTREE_TYPES_H
#define _BCACHEFS_BTREE_TYPES_H

#include <linux/list.h>
#include <linux/rhashtable.h>

#include "bbpos_types.h"
#include "btree_key_cache_types.h"
#include "buckets_types.h"
#include "darray.h"
#include "errcode.h"
#include "journal_types.h"
#include "replicas_types.h"
#include "six.h"

struct open_bucket;
struct btree_update;
struct btree_trans;

#define MAX_BSETS

struct btree_nr_keys {};

struct bset_tree {};

struct btree_write {};

struct btree_alloc {};

struct btree_bkey_cached_common {};

struct btree {};

struct btree_cache {};

struct btree_node_iter {};

#define BTREE_ITER_FLAGS()			\

#define STR_HASH_FLAGS()

#define BTREE_UPDATE_FLAGS()


/*
 * BTREE_TRIGGER_norun - don't run triggers at all
 *
 * BTREE_TRIGGER_transactional - we're running transactional triggers as part of
 * a transaction commit: triggers may generate new updates
 *
 * BTREE_TRIGGER_atomic - we're running atomic triggers during a transaction
 * commit: we have our journal reservation, we're holding btree node write
 * locks, and we know the transaction is going to commit (returning an error
 * here is a fatal error, causing us to go emergency read-only)
 *
 * BTREE_TRIGGER_gc - we're in gc/fsck: running triggers to recalculate e.g. disk usage
 *
 * BTREE_TRIGGER_insert - @new is entering the btree
 * BTREE_TRIGGER_overwrite - @old is leaving the btree
 *
 * BTREE_TRIGGER_bucket_invalidate - signal from bucket invalidate path to alloc
 * trigger
 */
#define BTREE_TRIGGER_FLAGS()

enum {};

/* iter flags must fit in a u16: */
//BUILD_BUG_ON(BTREE_ITER_FLAG_BIT_key_cache_fill > 15);

enum btree_iter_update_trigger_flags {};

enum btree_path_uptodate {};

#if defined(CONFIG_BCACHEFS_LOCK_TIME_STATS) || defined(CONFIG_BCACHEFS_DEBUG)
#define TRACK_PATH_ALLOCATED
#endif

btree_path_idx_t;

struct btree_path {};

static inline struct btree_path_level *path_l(struct btree_path *path)
{}

static inline unsigned long btree_path_ip_allocated(struct btree_path *path)
{}

/*
 * @pos			- iterator's current position
 * @level		- current btree depth
 * @locks_want		- btree level below which we start taking intent locks
 * @nodes_locked	- bitmask indicating which nodes in @nodes are locked
 * @nodes_intent_locked	- bitmask indicating which locks are intent locks
 */
struct btree_iter {};

#define BKEY_CACHED_ACCESSED
#define BKEY_CACHED_DIRTY

struct bkey_cached {};

static inline struct bpos btree_node_pos(struct btree_bkey_cached_common *b)
{}

struct btree_insert_entry {};

/* Number of btree paths we preallocate, usually enough */
#define BTREE_ITER_INITIAL
/*
 * Lmiit for btree_trans_too_many_iters(); this is enough that almost all code
 * paths should run inside this limit, and if they don't it usually indicates a
 * bug (leaking/duplicated btree paths).
 *
 * exception: some fsck paths
 *
 * bugs with excessive path usage seem to have possibly been eliminated now, so
 * we might consider eliminating this (and btree_trans_too_many_iter()) at some
 * point.
 */
#define BTREE_ITER_NORMAL_LIMIT
/* never exceed limit */
#define BTREE_ITER_MAX

struct btree_trans_commit_hook;
btree_trans_commit_hook_fn;

struct btree_trans_commit_hook {};

#define BTREE_TRANS_MEM_MAX

#define BTREE_TRANS_MAX_LOCK_HOLD_TIME_NS

struct btree_trans_paths {};

struct btree_trans {};

static inline struct btree_path *btree_iter_path(struct btree_trans *trans, struct btree_iter *iter)
{}

static inline struct btree_path *btree_iter_key_cache_path(struct btree_trans *trans, struct btree_iter *iter)
{}

#define BCH_BTREE_WRITE_TYPES()

enum btree_write_type {};

#define BTREE_WRITE_TYPE_MASK
#define BTREE_WRITE_TYPE_BITS

#define BTREE_FLAGS()

enum btree_flags {};

#define x

BTREE_FLAGS()
#undef x

static inline struct btree_write *btree_current_write(struct btree *b)
{}

static inline struct btree_write *btree_prev_write(struct btree *b)
{}

static inline struct bset_tree *bset_tree_last(struct btree *b)
{}

static inline void *
__btree_node_offset_to_ptr(const struct btree *b, u16 offset)
{}

static inline u16
__btree_node_ptr_to_offset(const struct btree *b, const void *p)
{}

static inline struct bset *bset(const struct btree *b,
				const struct bset_tree *t)
{}

static inline void set_btree_bset_end(struct btree *b, struct bset_tree *t)
{}

static inline void set_btree_bset(struct btree *b, struct bset_tree *t,
				  const struct bset *i)
{}

static inline struct bset *btree_bset_first(struct btree *b)
{}

static inline struct bset *btree_bset_last(struct btree *b)
{}

static inline u16
__btree_node_key_to_offset(const struct btree *b, const struct bkey_packed *k)
{}

static inline struct bkey_packed *
__btree_node_offset_to_key(const struct btree *b, u16 k)
{}

static inline unsigned btree_bkey_first_offset(const struct bset_tree *t)
{}

#define btree_bkey_first(_b, _t)

#define btree_bkey_last(_b, _t)

static inline unsigned bset_u64s(struct bset_tree *t)
{}

static inline unsigned bset_dead_u64s(struct btree *b, struct bset_tree *t)
{}

static inline unsigned bset_byte_offset(struct btree *b, void *i)
{}

enum btree_node_type {};

/* Type of a key in btree @id at level @level: */
static inline enum btree_node_type __btree_node_type(unsigned level, enum btree_id id)
{}

/* Type of keys @b contains: */
static inline enum btree_node_type btree_node_type(struct btree *b)
{}

const char *bch2_btree_node_type_str(enum btree_node_type);

#define BTREE_NODE_TYPE_HAS_TRANS_TRIGGERS

#define BTREE_NODE_TYPE_HAS_ATOMIC_TRIGGERS

#define BTREE_NODE_TYPE_HAS_TRIGGERS

static inline bool btree_node_type_has_trans_triggers(enum btree_node_type type)
{}

static inline bool btree_node_type_has_atomic_triggers(enum btree_node_type type)
{}

static inline bool btree_node_type_has_triggers(enum btree_node_type type)
{}

static inline bool btree_node_type_is_extents(enum btree_node_type type)
{}

static inline bool btree_id_is_extents(enum btree_id btree)
{}

static inline bool btree_type_has_snapshots(enum btree_id id)
{}

static inline bool btree_type_has_snapshot_field(enum btree_id id)
{}

static inline bool btree_type_has_ptrs(enum btree_id id)
{}

struct btree_root {};

enum btree_gc_coalesce_fail_reason {};

enum btree_node_sibling {};

struct get_locks_fail {};

#endif /* _BCACHEFS_BTREE_TYPES_H */