#include "bcachefs.h"
#include "alloc_background.h"
#include "alloc_foreground.h"
#include "backpointers.h"
#include "bkey_methods.h"
#include "bkey_buf.h"
#include "btree_journal_iter.h"
#include "btree_key_cache.h"
#include "btree_locking.h"
#include "btree_node_scan.h"
#include "btree_update_interior.h"
#include "btree_io.h"
#include "btree_gc.h"
#include "buckets.h"
#include "clock.h"
#include "debug.h"
#include "disk_accounting.h"
#include "ec.h"
#include "error.h"
#include "extents.h"
#include "journal.h"
#include "keylist.h"
#include "move.h"
#include "recovery_passes.h"
#include "reflink.h"
#include "replicas.h"
#include "super-io.h"
#include "trace.h"
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/freezer.h>
#include <linux/kthread.h>
#include <linux/preempt.h>
#include <linux/rcupdate.h>
#include <linux/sched/task.h>
#define DROP_THIS_NODE …
#define DROP_PREV_NODE …
#define DID_FILL_FROM_SCAN …
static const char * const bch2_gc_phase_strs[] = …;
void bch2_gc_pos_to_text(struct printbuf *out, struct gc_pos *p)
{ … }
static struct bkey_s unsafe_bkey_s_c_to_s(struct bkey_s_c k)
{ … }
static inline void __gc_pos_set(struct bch_fs *c, struct gc_pos new_pos)
{ … }
static inline void gc_pos_set(struct bch_fs *c, struct gc_pos new_pos)
{ … }
static void btree_ptr_to_v2(struct btree *b, struct bkey_i_btree_ptr_v2 *dst)
{ … }
static int set_node_min(struct bch_fs *c, struct btree *b, struct bpos new_min)
{ … }
static int set_node_max(struct bch_fs *c, struct btree *b, struct bpos new_max)
{ … }
static int btree_check_node_boundaries(struct btree_trans *trans, struct btree *b,
struct btree *prev, struct btree *cur,
struct bpos *pulled_from_scan)
{ … }
static int btree_repair_node_end(struct btree_trans *trans, struct btree *b,
struct btree *child, struct bpos *pulled_from_scan)
{ … }
static int bch2_btree_repair_topology_recurse(struct btree_trans *trans, struct btree *b,
struct bpos *pulled_from_scan)
{ … }
int bch2_check_topology(struct bch_fs *c)
{ … }
static int bch2_gc_mark_key(struct btree_trans *trans, enum btree_id btree_id,
unsigned level, struct btree **prev,
struct btree_iter *iter, struct bkey_s_c k,
bool initial)
{ … }
static int bch2_gc_btree(struct btree_trans *trans, enum btree_id btree, bool initial)
{ … }
static inline int btree_id_gc_phase_cmp(enum btree_id l, enum btree_id r)
{ … }
static int bch2_gc_btrees(struct bch_fs *c)
{ … }
static int bch2_mark_superblocks(struct bch_fs *c)
{ … }
static void bch2_gc_free(struct bch_fs *c)
{ … }
static int bch2_gc_start(struct bch_fs *c)
{ … }
static inline bool bch2_alloc_v4_cmp(struct bch_alloc_v4 l,
struct bch_alloc_v4 r)
{ … }
static int bch2_alloc_write_key(struct btree_trans *trans,
struct btree_iter *iter,
struct bch_dev *ca,
struct bkey_s_c k)
{ … }
static int bch2_gc_alloc_done(struct bch_fs *c)
{ … }
static int bch2_gc_alloc_start(struct bch_fs *c)
{ … }
static int bch2_gc_write_reflink_key(struct btree_trans *trans,
struct btree_iter *iter,
struct bkey_s_c k,
size_t *idx)
{ … }
static int bch2_gc_reflink_done(struct bch_fs *c)
{ … }
static int bch2_gc_reflink_start(struct bch_fs *c)
{ … }
static int bch2_gc_write_stripes_key(struct btree_trans *trans,
struct btree_iter *iter,
struct bkey_s_c k)
{ … }
static int bch2_gc_stripes_done(struct bch_fs *c)
{ … }
int bch2_check_allocations(struct bch_fs *c)
{ … }
static int gc_btree_gens_key(struct btree_trans *trans,
struct btree_iter *iter,
struct bkey_s_c k)
{ … }
static int bch2_alloc_write_oldest_gen(struct btree_trans *trans, struct bch_dev *ca,
struct btree_iter *iter, struct bkey_s_c k)
{ … }
int bch2_gc_gens(struct bch_fs *c)
{ … }
static void bch2_gc_gens_work(struct work_struct *work)
{ … }
void bch2_gc_gens_async(struct bch_fs *c)
{ … }
void bch2_fs_gc_init(struct bch_fs *c)
{ … }