bcachefs: Increase size of btree node reserve

Also tweak the allocator to be more aggressive about keeping it full.
The recent changes to make updates to interior nodes transactional (and
thus generate updates to the alloc btree) all put more stress on the
btree node reserves.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2020-06-15 17:38:26 -04:00 committed by Kent Overstreet
parent e27b03b35b
commit 7dd1ebfa1e
2 changed files with 7 additions and 4 deletions

View File

@ -501,6 +501,7 @@ static void bch2_bucket_clock_init(struct bch_fs *c, int rw)
static int wait_buckets_available(struct bch_fs *c, struct bch_dev *ca) static int wait_buckets_available(struct bch_fs *c, struct bch_dev *ca)
{ {
unsigned long gc_count = c->gc_count; unsigned long gc_count = c->gc_count;
u64 available;
int ret = 0; int ret = 0;
ca->allocator_state = ALLOCATOR_BLOCKED; ca->allocator_state = ALLOCATOR_BLOCKED;
@ -516,9 +517,11 @@ static int wait_buckets_available(struct bch_fs *c, struct bch_dev *ca)
if (gc_count != c->gc_count) if (gc_count != c->gc_count)
ca->inc_gen_really_needs_gc = 0; ca->inc_gen_really_needs_gc = 0;
if ((ssize_t) (dev_buckets_available(c, ca) - available = max_t(s64, 0, dev_buckets_available(c, ca) -
ca->inc_gen_really_needs_gc) >= ca->inc_gen_really_needs_gc);
(ssize_t) fifo_free(&ca->free_inc))
if (available > fifo_free(&ca->free_inc) ||
(available && !fifo_full(&ca->free[RESERVE_BTREE])))
break; break;
up_read(&c->gc_lock); up_read(&c->gc_lock);

View File

@ -340,7 +340,7 @@ enum bch_time_stats {
#define BTREE_RESERVE_MAX (BTREE_MAX_DEPTH + (BTREE_MAX_DEPTH - 1)) #define BTREE_RESERVE_MAX (BTREE_MAX_DEPTH + (BTREE_MAX_DEPTH - 1))
/* Size of the freelist we allocate btree nodes from: */ /* Size of the freelist we allocate btree nodes from: */
#define BTREE_NODE_RESERVE BTREE_RESERVE_MAX #define BTREE_NODE_RESERVE (BTREE_RESERVE_MAX * 4)
#define BTREE_NODE_OPEN_BUCKET_RESERVE (BTREE_RESERVE_MAX * BCH_REPLICAS_MAX) #define BTREE_NODE_OPEN_BUCKET_RESERVE (BTREE_RESERVE_MAX * BCH_REPLICAS_MAX)