#include "bcachefs.h"
#include "bkey_methods.h"
#include "btree_cache.h"
#include "btree_gc.h"
#include "btree_io.h"
#include "btree_iter.h"
#include "buckets.h"
#include "checksum.h"
#include "compress.h"
#include "debug.h"
#include "disk_groups.h"
#include "error.h"
#include "extents.h"
#include "inode.h"
#include "journal.h"
#include "replicas.h"
#include "super.h"
#include "super-io.h"
#include "trace.h"
#include "util.h"
static unsigned bch2_crc_field_size_max[] = …;
static void bch2_extent_crc_pack(union bch_extent_crc *,
struct bch_extent_crc_unpacked,
enum bch_extent_entry_type);
struct bch_dev_io_failures *bch2_dev_io_failures(struct bch_io_failures *f,
unsigned dev)
{ … }
void bch2_mark_io_failure(struct bch_io_failures *failed,
struct extent_ptr_decoded *p)
{ … }
static inline u64 dev_latency(struct bch_fs *c, unsigned dev)
{ … }
static inline bool ptr_better(struct bch_fs *c,
const struct extent_ptr_decoded p1,
const struct extent_ptr_decoded p2)
{ … }
int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k,
struct bch_io_failures *failed,
struct extent_ptr_decoded *pick)
{ … }
int bch2_btree_ptr_invalid(struct bch_fs *c, struct bkey_s_c k,
enum bch_validate_flags flags,
struct printbuf *err)
{ … }
void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c,
struct bkey_s_c k)
{ … }
int bch2_btree_ptr_v2_invalid(struct bch_fs *c, struct bkey_s_c k,
enum bch_validate_flags flags,
struct printbuf *err)
{ … }
void bch2_btree_ptr_v2_to_text(struct printbuf *out, struct bch_fs *c,
struct bkey_s_c k)
{ … }
void bch2_btree_ptr_v2_compat(enum btree_id btree_id, unsigned version,
unsigned big_endian, int write,
struct bkey_s k)
{ … }
bool bch2_extent_merge(struct bch_fs *c, struct bkey_s l, struct bkey_s_c r)
{ … }
int bch2_reservation_invalid(struct bch_fs *c, struct bkey_s_c k,
enum bch_validate_flags flags,
struct printbuf *err)
{ … }
void bch2_reservation_to_text(struct printbuf *out, struct bch_fs *c,
struct bkey_s_c k)
{ … }
bool bch2_reservation_merge(struct bch_fs *c, struct bkey_s _l, struct bkey_s_c _r)
{ … }
static inline bool bch2_crc_unpacked_cmp(struct bch_extent_crc_unpacked l,
struct bch_extent_crc_unpacked r)
{ … }
static inline bool can_narrow_crc(struct bch_extent_crc_unpacked u,
struct bch_extent_crc_unpacked n)
{ … }
bool bch2_can_narrow_extent_crcs(struct bkey_s_c k,
struct bch_extent_crc_unpacked n)
{ … }
bool bch2_bkey_narrow_crcs(struct bkey_i *k, struct bch_extent_crc_unpacked n)
{ … }
static void bch2_extent_crc_pack(union bch_extent_crc *dst,
struct bch_extent_crc_unpacked src,
enum bch_extent_entry_type type)
{ … }
void bch2_extent_crc_append(struct bkey_i *k,
struct bch_extent_crc_unpacked new)
{ … }
unsigned bch2_bkey_nr_ptrs(struct bkey_s_c k)
{ … }
unsigned bch2_bkey_nr_ptrs_allocated(struct bkey_s_c k)
{ … }
unsigned bch2_bkey_nr_ptrs_fully_allocated(struct bkey_s_c k)
{ … }
unsigned bch2_bkey_sectors_compressed(struct bkey_s_c k)
{ … }
bool bch2_bkey_is_incompressible(struct bkey_s_c k)
{ … }
unsigned bch2_bkey_replicas(struct bch_fs *c, struct bkey_s_c k)
{ … }
static inline unsigned __extent_ptr_durability(struct bch_dev *ca, struct extent_ptr_decoded *p)
{ … }
unsigned bch2_extent_ptr_desired_durability(struct bch_fs *c, struct extent_ptr_decoded *p)
{ … }
unsigned bch2_extent_ptr_durability(struct bch_fs *c, struct extent_ptr_decoded *p)
{ … }
unsigned bch2_bkey_durability(struct bch_fs *c, struct bkey_s_c k)
{ … }
static unsigned bch2_bkey_durability_safe(struct bch_fs *c, struct bkey_s_c k)
{ … }
void bch2_bkey_extent_entry_drop(struct bkey_i *k, union bch_extent_entry *entry)
{ … }
void bch2_extent_ptr_decoded_append(struct bkey_i *k,
struct extent_ptr_decoded *p)
{ … }
static union bch_extent_entry *extent_entry_prev(struct bkey_ptrs ptrs,
union bch_extent_entry *entry)
{ … }
union bch_extent_entry *bch2_bkey_drop_ptr_noerror(struct bkey_s k,
struct bch_extent_ptr *ptr)
{ … }
union bch_extent_entry *bch2_bkey_drop_ptr(struct bkey_s k,
struct bch_extent_ptr *ptr)
{ … }
void bch2_bkey_drop_device(struct bkey_s k, unsigned dev)
{ … }
void bch2_bkey_drop_device_noerror(struct bkey_s k, unsigned dev)
{ … }
const struct bch_extent_ptr *bch2_bkey_has_device_c(struct bkey_s_c k, unsigned dev)
{ … }
bool bch2_bkey_has_target(struct bch_fs *c, struct bkey_s_c k, unsigned target)
{ … }
bool bch2_bkey_matches_ptr(struct bch_fs *c, struct bkey_s_c k,
struct bch_extent_ptr m, u64 offset)
{ … }
bool bch2_extents_match(struct bkey_s_c k1, struct bkey_s_c k2)
{ … }
struct bch_extent_ptr *
bch2_extent_has_ptr(struct bkey_s_c k1, struct extent_ptr_decoded p1, struct bkey_s k2)
{ … }
void bch2_extent_ptr_set_cached(struct bkey_s k, struct bch_extent_ptr *ptr)
{ … }
bool bch2_extent_normalize(struct bch_fs *c, struct bkey_s k)
{ … }
void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struct bch_extent_ptr *ptr)
{ … }
void bch2_extent_crc_unpacked_to_text(struct printbuf *out, struct bch_extent_crc_unpacked *crc)
{ … }
void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
struct bkey_s_c k)
{ … }
static int extent_ptr_invalid(struct bch_fs *c,
struct bkey_s_c k,
enum bch_validate_flags flags,
const struct bch_extent_ptr *ptr,
unsigned size_ondisk,
bool metadata,
struct printbuf *err)
{ … }
int bch2_bkey_ptrs_invalid(struct bch_fs *c, struct bkey_s_c k,
enum bch_validate_flags flags,
struct printbuf *err)
{ … }
void bch2_ptr_swab(struct bkey_s k)
{ … }
const struct bch_extent_rebalance *bch2_bkey_rebalance_opts(struct bkey_s_c k)
{ … }
unsigned bch2_bkey_ptrs_need_rebalance(struct bch_fs *c, struct bkey_s_c k,
unsigned target, unsigned compression)
{ … }
bool bch2_bkey_needs_rebalance(struct bch_fs *c, struct bkey_s_c k)
{ … }
int bch2_bkey_set_needs_rebalance(struct bch_fs *c, struct bkey_i *_k,
struct bch_io_opts *opts)
{ … }
int bch2_cut_front_s(struct bpos where, struct bkey_s k)
{ … }
int bch2_cut_back_s(struct bpos where, struct bkey_s k)
{ … }