summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-06-09 15:44:03 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2020-06-09 21:32:47 -0400
commit4731055fa223be13e3a7c1160b88297100741641 (patch)
tree5f694ca9478f3f8e9aa01c579d2981cf79500939
parentd69504f98bb021f817c0282848434dbb120afb04 (diff)
bcachefs: More open buckets
We need a larger open bucket reserve now that the btree interior update path holds onto open bucket references; filesystems with many high through devices may need more open buckets now. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/alloc_types.h16
-rw-r--r--fs/bcachefs/bcachefs.h8
-rw-r--r--fs/bcachefs/btree_update_interior.h4
3 files changed, 17 insertions, 11 deletions
diff --git a/fs/bcachefs/alloc_types.h b/fs/bcachefs/alloc_types.h
index 832568dc9551..4f1465077994 100644
--- a/fs/bcachefs/alloc_types.h
+++ b/fs/bcachefs/alloc_types.h
@@ -46,16 +46,22 @@ enum alloc_reserve {
typedef FIFO(long) alloc_fifo;
-/* Enough for 16 cache devices, 2 tiers and some left over for pipelining */
-#define OPEN_BUCKETS_COUNT 256
+#define OPEN_BUCKETS_COUNT 1024
#define WRITE_POINT_HASH_NR 32
#define WRITE_POINT_MAX 32
+typedef u16 open_bucket_idx_t;
+
struct open_bucket {
spinlock_t lock;
atomic_t pin;
- u8 freelist;
+ open_bucket_idx_t freelist;
+
+ /*
+ * When an open bucket has an ec_stripe attached, this is the index of
+ * the block in the stripe this open_bucket corresponds to:
+ */
u8 ec_idx;
u8 type;
unsigned valid:1;
@@ -68,8 +74,8 @@ struct open_bucket {
#define OPEN_BUCKET_LIST_MAX 15
struct open_buckets {
- u8 nr;
- u8 v[OPEN_BUCKET_LIST_MAX];
+ open_bucket_idx_t nr;
+ open_bucket_idx_t v[OPEN_BUCKET_LIST_MAX];
};
struct dev_stripe_state {
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 71e747c56008..61000459659f 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -426,8 +426,8 @@ struct bch_dev {
alloc_fifo free[RESERVE_NR];
alloc_fifo free_inc;
- u8 open_buckets_partial[OPEN_BUCKETS_COUNT];
- unsigned open_buckets_partial_nr;
+ open_bucket_idx_t open_buckets_partial[OPEN_BUCKETS_COUNT];
+ open_bucket_idx_t open_buckets_partial_nr;
size_t fifo_last_bucket;
@@ -686,8 +686,8 @@ struct bch_fs {
struct closure_waitlist freelist_wait;
u64 blocked_allocate;
u64 blocked_allocate_open_bucket;
- u8 open_buckets_freelist;
- u8 open_buckets_nr_free;
+ open_bucket_idx_t open_buckets_freelist;
+ open_bucket_idx_t open_buckets_nr_free;
struct closure_waitlist open_buckets_wait;
struct open_bucket open_buckets[OPEN_BUCKETS_COUNT];
diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h
index a6be62d3a18f..e00dc51ff3eb 100644
--- a/fs/bcachefs/btree_update_interior.h
+++ b/fs/bcachefs/btree_update_interior.h
@@ -92,9 +92,9 @@ struct btree_update {
struct btree *new_nodes[BTREE_UPDATE_NODES_MAX];
unsigned nr_new_nodes;
- u8 open_buckets[BTREE_UPDATE_NODES_MAX *
+ open_bucket_idx_t open_buckets[BTREE_UPDATE_NODES_MAX *
BCH_REPLICAS_MAX];
- u8 nr_open_buckets;
+ open_bucket_idx_t nr_open_buckets;
unsigned journal_u64s;
u64 journal_entries[BTREE_UPDATE_JOURNAL_RES];