5 #include "keylist_types.h"
7 const char *bch2_stripe_invalid(const struct bch_fs *, struct bkey_s_c);
8 void bch2_stripe_to_text(struct printbuf *, struct bch_fs *,
11 #define bch2_bkey_ops_stripe (struct bkey_ops) { \
12 .key_invalid = bch2_stripe_invalid, \
13 .val_to_text = bch2_stripe_to_text, \
18 struct ec_stripe_buf {
19 /* might not be buffering the entire stripe: */
22 unsigned long valid[BITS_TO_LONGS(EC_STRIPE_MAX)];
24 void *data[EC_STRIPE_MAX];
27 struct bkey_i_stripe key;
32 struct ec_stripe_head;
34 struct ec_stripe_new {
36 struct ec_stripe_head *h;
38 struct list_head list;
40 /* counts in flight writes, stripe is created when pin == 0 */
45 unsigned long blocks_allocated[BITS_TO_LONGS(EC_STRIPE_MAX)];
47 struct open_buckets blocks;
48 struct open_buckets parity;
51 u64 inline_keys[BKEY_U64s * 8];
53 struct ec_stripe_buf stripe;
56 struct ec_stripe_head {
57 struct list_head list;
60 struct list_head stripes;
66 struct bch_devs_mask devs;
67 unsigned nr_active_devs;
71 struct dev_stripe_state block_stripe;
72 struct dev_stripe_state parity_stripe;
74 struct open_buckets blocks;
75 struct open_buckets parity;
77 struct ec_stripe_new *s;
80 int bch2_ec_read_extent(struct bch_fs *, struct bch_read_bio *);
82 void *bch2_writepoint_ec_buf(struct bch_fs *, struct write_point *);
83 void bch2_ec_add_backpointer(struct bch_fs *, struct write_point *,
84 struct bpos, unsigned);
86 void bch2_ec_bucket_written(struct bch_fs *, struct open_bucket *);
87 void bch2_ec_bucket_cancel(struct bch_fs *, struct open_bucket *);
89 int bch2_ec_stripe_new_alloc(struct bch_fs *, struct ec_stripe_head *);
91 void bch2_ec_stripe_head_put(struct ec_stripe_head *);
92 struct ec_stripe_head *bch2_ec_stripe_head_get(struct bch_fs *, unsigned,
95 void bch2_stripes_heap_update(struct bch_fs *, struct stripe *, size_t);
96 void bch2_stripes_heap_del(struct bch_fs *, struct stripe *, size_t);
97 void bch2_stripes_heap_insert(struct bch_fs *, struct stripe *, size_t);
99 void bch2_ec_stop_dev(struct bch_fs *, struct bch_dev *);
101 void bch2_ec_flush_new_stripes(struct bch_fs *);
103 int bch2_ec_mem_alloc(struct bch_fs *, bool);
105 int bch2_fs_ec_start(struct bch_fs *);
107 void bch2_fs_ec_exit(struct bch_fs *);
108 int bch2_fs_ec_init(struct bch_fs *);
110 #endif /* _BCACHEFS_EC_H */