summaryrefslogtreecommitdiff
path: root/libbcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-05-14 21:46:09 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2020-05-14 21:48:52 -0400
commit34c9be19b376a007041555a7c9a47dfef3d0b1e6 (patch)
tree3ae88a4104761592131d7aaa98b8a9ca9044ac22 /libbcachefs/alloc_background.c
parent024a01bf077a6f887b82fb74b7bd252a350dfa30 (diff)
Update bcachefs sources to e1f6739c4a bcachefs: Fix another iterator counting bug
Diffstat (limited to 'libbcachefs/alloc_background.c')
-rw-r--r--libbcachefs/alloc_background.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libbcachefs/alloc_background.c b/libbcachefs/alloc_background.c
index b2d1b8f9..c3794518 100644
--- a/libbcachefs/alloc_background.c
+++ b/libbcachefs/alloc_background.c
@@ -315,7 +315,9 @@ retry:
bch2_trans_update(trans, iter, &a->k_i,
BTREE_TRIGGER_NORUN);
ret = bch2_trans_commit(trans, NULL, NULL,
- BTREE_INSERT_NOFAIL|flags);
+ BTREE_INSERT_NOFAIL|
+ BTREE_INSERT_USE_RESERVE|
+ flags);
err:
if (ret == -EINTR)
goto retry;
@@ -1033,7 +1035,16 @@ static int push_invalidated_bucket(struct bch_fs *c, struct bch_dev *ca, size_t
set_current_state(TASK_INTERRUPTIBLE);
spin_lock(&c->freelist_lock);
- for (i = 0; i < RESERVE_NR; i++)
+ for (i = 0; i < RESERVE_NR; i++) {
+
+ /*
+ * Don't strand buckets on the copygc freelist until
+ * after recovery is finished:
+ */
+ if (!test_bit(BCH_FS_STARTED, &c->flags) &&
+ i == RESERVE_MOVINGGC)
+ continue;
+
if (fifo_push(&ca->free[i], bucket)) {
fifo_pop(&ca->free_inc, bucket);
@@ -1043,6 +1054,7 @@ static int push_invalidated_bucket(struct bch_fs *c, struct bch_dev *ca, size_t
spin_unlock(&c->freelist_lock);
goto out;
}
+ }
if (ca->allocator_state != ALLOCATOR_BLOCKED_FULL) {
ca->allocator_state = ALLOCATOR_BLOCKED_FULL;