diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-12-16 22:23:27 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:50 +0300 |
commit | ffb7c3d370a104d14ad0658b359cdf04ae679f04 (patch) | |
tree | 8bc29b326f11dd7ef8a6cbe5065f3b361b11aefa | |
parent | ded54580bdf18ba3a2b38e7910c54b1c53f007c6 (diff) | |
download | linux-ffb7c3d370a104d14ad0658b359cdf04ae679f04.tar.xz |
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>
-rw-r--r-- | fs/bcachefs/bcachefs_format.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/ec.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/ec.h | 8 | ||||
-rw-r--r-- | fs/bcachefs/ec_types.h | 6 | ||||
-rw-r--r-- | fs/bcachefs/super_types.h | 2 |
5 files changed, 13 insertions, 13 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index 7df2bc7ecd4f..3f8281b5db41 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -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, diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index db1c652f1ed4..95abc00bd0e0 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -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; } diff --git a/fs/bcachefs/ec.h b/fs/bcachefs/ec.h index 15f751fc2a35..450bb1a113a3 100644 --- a/fs/bcachefs/ec.h +++ b/fs/bcachefs/ec.h @@ -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; diff --git a/fs/bcachefs/ec_types.h b/fs/bcachefs/ec_types.h index e4d633fca5bf..5b688b4394f7 100644 --- a/fs/bcachefs/ec_types.h +++ b/fs/bcachefs/ec_types.h @@ -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; }; diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h index 6d0168a73ee4..e3a989e3e9d9 100644 --- a/fs/bcachefs/super_types.h +++ b/fs/bcachefs/super_types.h @@ -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 { |