mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-06 09:56:25 -04:00
bcachefs: Add BCH_BKEY_PTRS_MAX
This now means "the maximum number of pointers within a bkey" - and bch_devs_list is updated to use it instead of BCH_REPLICAS_MAX, since stripes can contain more than BCH_REPLICAS_MAX pointers. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
committed by
Kent Overstreet
parent
ded54580bd
commit
ffb7c3d370
@@ -1363,6 +1363,8 @@ enum bch_sb_compat {
|
||||
|
||||
#define BCH_REPLICAS_MAX 4U
|
||||
|
||||
#define BCH_BKEY_PTRS_MAX 16U
|
||||
|
||||
enum bch_error_actions {
|
||||
BCH_ON_ERROR_CONTINUE = 0,
|
||||
BCH_ON_ERROR_RO = 1,
|
||||
|
||||
@@ -300,7 +300,7 @@ static unsigned ec_nr_failed(struct ec_stripe_buf *buf)
|
||||
static int ec_do_recov(struct bch_fs *c, struct ec_stripe_buf *buf)
|
||||
{
|
||||
struct bch_stripe *v = &buf->key.v;
|
||||
unsigned i, failed[EC_STRIPE_MAX], nr_failed = 0;
|
||||
unsigned i, failed[BCH_BKEY_PTRS_MAX], nr_failed = 0;
|
||||
unsigned nr_data = v->nr_blocks - v->nr_redundant;
|
||||
unsigned bytes = buf->size << 9;
|
||||
|
||||
@@ -1101,7 +1101,7 @@ static int ec_new_stripe_alloc(struct bch_fs *c, struct ec_stripe_head *h)
|
||||
s->c = c;
|
||||
s->h = h;
|
||||
s->nr_data = min_t(unsigned, h->nr_active_devs,
|
||||
EC_STRIPE_MAX) - h->redundancy;
|
||||
BCH_BKEY_PTRS_MAX) - h->redundancy;
|
||||
s->nr_parity = h->redundancy;
|
||||
|
||||
bch2_keylist_init(&s->keys, s->inline_keys);
|
||||
@@ -1211,13 +1211,13 @@ static int new_stripe_alloc_buckets(struct bch_fs *c, struct ec_stripe_head *h)
|
||||
struct open_bucket *ob;
|
||||
unsigned i, nr_have, nr_data =
|
||||
min_t(unsigned, h->nr_active_devs,
|
||||
EC_STRIPE_MAX) - h->redundancy;
|
||||
BCH_BKEY_PTRS_MAX) - h->redundancy;
|
||||
bool have_cache = true;
|
||||
int ret = 0;
|
||||
|
||||
devs = h->devs;
|
||||
|
||||
for_each_set_bit(i, h->s->blocks_allocated, EC_STRIPE_MAX) {
|
||||
for_each_set_bit(i, h->s->blocks_allocated, BCH_BKEY_PTRS_MAX) {
|
||||
__clear_bit(h->s->stripe.key.v.ptrs[i].dev, devs.d);
|
||||
--nr_data;
|
||||
}
|
||||
|
||||
@@ -71,9 +71,9 @@ struct ec_stripe_buf {
|
||||
/* might not be buffering the entire stripe: */
|
||||
unsigned offset;
|
||||
unsigned size;
|
||||
unsigned long valid[BITS_TO_LONGS(EC_STRIPE_MAX)];
|
||||
unsigned long valid[BITS_TO_LONGS(BCH_BKEY_PTRS_MAX)];
|
||||
|
||||
void *data[EC_STRIPE_MAX];
|
||||
void *data[BCH_BKEY_PTRS_MAX];
|
||||
|
||||
union {
|
||||
struct bkey_i_stripe key;
|
||||
@@ -101,10 +101,10 @@ struct ec_stripe_new {
|
||||
bool existing_stripe;
|
||||
u64 existing_stripe_idx;
|
||||
|
||||
unsigned long blocks_allocated[BITS_TO_LONGS(EC_STRIPE_MAX)];
|
||||
unsigned long blocks_allocated[BITS_TO_LONGS(BCH_BKEY_PTRS_MAX)];
|
||||
|
||||
struct open_buckets blocks;
|
||||
u8 data_block_idx[EC_STRIPE_MAX];
|
||||
u8 data_block_idx[BCH_BKEY_PTRS_MAX];
|
||||
struct open_buckets parity;
|
||||
struct disk_reservation res;
|
||||
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
|
||||
#include <linux/llist.h>
|
||||
|
||||
#define EC_STRIPE_MAX 16
|
||||
|
||||
struct bch_replicas_padded {
|
||||
struct bch_replicas_entry e;
|
||||
u8 pad[EC_STRIPE_MAX];
|
||||
u8 pad[BCH_BKEY_PTRS_MAX];
|
||||
};
|
||||
|
||||
struct stripe {
|
||||
@@ -24,7 +22,7 @@ struct stripe {
|
||||
unsigned dirty:1;
|
||||
unsigned on_heap:1;
|
||||
u8 blocks_nonempty;
|
||||
u16 block_sectors[EC_STRIPE_MAX];
|
||||
u16 block_sectors[BCH_BKEY_PTRS_MAX];
|
||||
|
||||
struct bch_replicas_padded r;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ struct bch_devs_mask {
|
||||
|
||||
struct bch_devs_list {
|
||||
u8 nr;
|
||||
u8 devs[BCH_REPLICAS_MAX + 1];
|
||||
u8 devs[BCH_BKEY_PTRS_MAX];
|
||||
};
|
||||
|
||||
struct bch_member_cpu {
|
||||
|
||||
Reference in New Issue
Block a user