#include "bcachefs.h"
#include "buckets.h"
#include "disk_accounting.h"
#include "journal.h"
#include "replicas.h"
#include "super-io.h"
#include <linux/sort.h>
static int bch2_cpu_replicas_to_sb_replicas(struct bch_fs *,
struct bch_replicas_cpu *);
static int bch2_memcmp(const void *l, const void *r, const void *priv)
{ … }
static void verify_replicas_entry(struct bch_replicas_entry_v1 *e)
{ … }
void bch2_replicas_entry_sort(struct bch_replicas_entry_v1 *e)
{ … }
static void bch2_cpu_replicas_sort(struct bch_replicas_cpu *r)
{ … }
static void bch2_replicas_entry_v0_to_text(struct printbuf *out,
struct bch_replicas_entry_v0 *e)
{ … }
void bch2_replicas_entry_to_text(struct printbuf *out,
struct bch_replicas_entry_v1 *e)
{ … }
int bch2_replicas_entry_validate(struct bch_replicas_entry_v1 *r,
struct bch_sb *sb,
struct printbuf *err)
{ … }
void bch2_cpu_replicas_to_text(struct printbuf *out,
struct bch_replicas_cpu *r)
{ … }
static void extent_to_replicas(struct bkey_s_c k,
struct bch_replicas_entry_v1 *r)
{ … }
static void stripe_to_replicas(struct bkey_s_c k,
struct bch_replicas_entry_v1 *r)
{ … }
void bch2_bkey_to_replicas(struct bch_replicas_entry_v1 *e,
struct bkey_s_c k)
{ … }
void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *e,
enum bch_data_type data_type,
struct bch_devs_list devs)
{ … }
static struct bch_replicas_cpu
cpu_replicas_add_entry(struct bch_fs *c,
struct bch_replicas_cpu *old,
struct bch_replicas_entry_v1 *new_entry)
{ … }
static inline int __replicas_entry_idx(struct bch_replicas_cpu *r,
struct bch_replicas_entry_v1 *search)
{ … }
int bch2_replicas_entry_idx(struct bch_fs *c,
struct bch_replicas_entry_v1 *search)
{ … }
static bool __replicas_has_entry(struct bch_replicas_cpu *r,
struct bch_replicas_entry_v1 *search)
{ … }
bool bch2_replicas_marked_locked(struct bch_fs *c,
struct bch_replicas_entry_v1 *search)
{ … }
bool bch2_replicas_marked(struct bch_fs *c,
struct bch_replicas_entry_v1 *search)
{ … }
noinline
static int bch2_mark_replicas_slowpath(struct bch_fs *c,
struct bch_replicas_entry_v1 *new_entry)
{ … }
int bch2_mark_replicas(struct bch_fs *c, struct bch_replicas_entry_v1 *r)
{ … }
int bch2_replicas_gc_end(struct bch_fs *c, int ret)
{ … }
int bch2_replicas_gc_start(struct bch_fs *c, unsigned typemask)
{ … }
int bch2_replicas_gc2(struct bch_fs *c)
{ … }
static int
__bch2_sb_replicas_to_cpu_replicas(struct bch_sb_field_replicas *sb_r,
struct bch_replicas_cpu *cpu_r)
{ … }
static int
__bch2_sb_replicas_v0_to_cpu_replicas(struct bch_sb_field_replicas_v0 *sb_r,
struct bch_replicas_cpu *cpu_r)
{ … }
int bch2_sb_replicas_to_cpu_replicas(struct bch_fs *c)
{ … }
static int bch2_cpu_replicas_to_sb_replicas_v0(struct bch_fs *c,
struct bch_replicas_cpu *r)
{ … }
static int bch2_cpu_replicas_to_sb_replicas(struct bch_fs *c,
struct bch_replicas_cpu *r)
{ … }
static int bch2_cpu_replicas_validate(struct bch_replicas_cpu *cpu_r,
struct bch_sb *sb,
struct printbuf *err)
{ … }
static int bch2_sb_replicas_validate(struct bch_sb *sb, struct bch_sb_field *f,
enum bch_validate_flags flags, struct printbuf *err)
{ … }
static void bch2_sb_replicas_to_text(struct printbuf *out,
struct bch_sb *sb,
struct bch_sb_field *f)
{ … }
const struct bch_sb_field_ops bch_sb_field_ops_replicas = …;
static int bch2_sb_replicas_v0_validate(struct bch_sb *sb, struct bch_sb_field *f,
enum bch_validate_flags flags, struct printbuf *err)
{ … }
static void bch2_sb_replicas_v0_to_text(struct printbuf *out,
struct bch_sb *sb,
struct bch_sb_field *f)
{ … }
const struct bch_sb_field_ops bch_sb_field_ops_replicas_v0 = …;
bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs,
unsigned flags, bool print)
{ … }
unsigned bch2_sb_dev_has_data(struct bch_sb *sb, unsigned dev)
{ … }
unsigned bch2_dev_has_data(struct bch_fs *c, struct bch_dev *ca)
{ … }
void bch2_fs_replicas_exit(struct bch_fs *c)
{ … }