summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/bcachefs/alloc_foreground.c6
-rw-r--r--fs/bcachefs/alloc_types.h4
-rw-r--r--fs/bcachefs/btree_update_interior.c4
3 files changed, 9 insertions, 5 deletions
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index df9f022e6926..476c46f596cc 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -204,8 +204,11 @@ success:
static inline unsigned open_buckets_reserved(enum alloc_reserve reserve)
{
switch (reserve) {
- case RESERVE_MOVINGGC:
+ case RESERVE_BTREE:
+ case RESERVE_BTREE_MOVINGGC:
return 0;
+ case RESERVE_MOVINGGC:
+ return OPEN_BUCKETS_COUNT / 4;
default:
return OPEN_BUCKETS_COUNT / 2;
}
@@ -261,6 +264,7 @@ struct open_bucket *bch2_bucket_alloc(struct bch_fs *c, struct bch_dev *ca,
goto out;
switch (reserve) {
+ case RESERVE_BTREE_MOVINGGC:
case RESERVE_MOVINGGC:
if (fifo_pop(&ca->free[RESERVE_MOVINGGC], bucket))
goto out;
diff --git a/fs/bcachefs/alloc_types.h b/fs/bcachefs/alloc_types.h
index 0cfb026a02e5..1abfff5290bc 100644
--- a/fs/bcachefs/alloc_types.h
+++ b/fs/bcachefs/alloc_types.h
@@ -34,9 +34,9 @@ struct bucket_clock {
struct mutex lock;
};
-/* There is one reserve for each type of btree, one for prios and gens
- * and one for moving GC */
enum alloc_reserve {
+ RESERVE_BTREE_MOVINGGC = -2,
+ RESERVE_BTREE = -1,
RESERVE_MOVINGGC = 0,
RESERVE_NONE = 1,
RESERVE_NR = 2,
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 2fa3a9aeb89a..c25ce358f931 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -203,10 +203,10 @@ static struct btree *__bch2_btree_node_alloc(struct bch_fs *c,
if (flags & BTREE_INSERT_USE_RESERVE) {
nr_reserve = 0;
- alloc_reserve = RESERVE_MOVINGGC;
+ alloc_reserve = RESERVE_BTREE_MOVINGGC;
} else {
nr_reserve = BTREE_NODE_RESERVE;
- alloc_reserve = RESERVE_NONE;
+ alloc_reserve = RESERVE_BTREE;
}
mutex_lock(&c->btree_reserve_cache_lock);