summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-06-15 17:38:26 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:41 -0400
commit7dd1ebfa1ec156d54238126c3ce7f0fb31ea7a45 (patch)
tree80beeb7dbc714d0201c3f89bf168e30556514625 /fs/bcachefs/alloc_background.c
parente27b03b35b09f9cbee9a69bd99951d7adaf02fa7 (diff)
downloadlinux-7dd1ebfa1ec156d54238126c3ce7f0fb31ea7a45.tar.gz
linux-7dd1ebfa1ec156d54238126c3ce7f0fb31ea7a45.tar.bz2
linux-7dd1ebfa1ec156d54238126c3ce7f0fb31ea7a45.zip
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>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 678218ca0feb..93ee5cdfbe35 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -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)
{
unsigned long gc_count = c->gc_count;
+ u64 available;
int ret = 0;
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)
ca->inc_gen_really_needs_gc = 0;
- if ((ssize_t) (dev_buckets_available(c, ca) -
- ca->inc_gen_really_needs_gc) >=
- (ssize_t) fifo_free(&ca->free_inc))
+ available = max_t(s64, 0, dev_buckets_available(c, ca) -
+ ca->inc_gen_really_needs_gc);
+
+ if (available > fifo_free(&ca->free_inc) ||
+ (available && !fifo_full(&ca->free[RESERVE_BTREE])))
break;
up_read(&c->gc_lock);