summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-01-11 05:07:29 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2018-05-22 00:44:18 -0400
commit205b22aeaa52cb1053c00244531a01bd97b6300e (patch)
treee90ed531a56c90be24a889853ae640e2728d0879 /fs/bcachefs/alloc.c
parent87a643c16fc19e74614d984e1564a0d9838fd5f8 (diff)
bcachefs: Allocate new btree roots lazily
fixes a bug with allocating the quota btree root on existing filesystems
Diffstat (limited to 'fs/bcachefs/alloc.c')
-rw-r--r--fs/bcachefs/alloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/alloc.c b/fs/bcachefs/alloc.c
index fc492da530e3..f7ff8027661c 100644
--- a/fs/bcachefs/alloc.c
+++ b/fs/bcachefs/alloc.c
@@ -292,9 +292,6 @@ int bch2_alloc_read(struct bch_fs *c, struct list_head *journal_replay_list)
unsigned i;
int ret;
- if (!c->btree_roots[BTREE_ID_ALLOC].b)
- return 0;
-
for_each_btree_key(&iter, c, BTREE_ID_ALLOC, POS_MIN, 0, k) {
bch2_alloc_read_key(c, k);
bch2_btree_iter_cond_resched(&iter);
@@ -539,7 +536,8 @@ static void bch2_prio_timer_init(struct bch_fs *c, int rw)
static void verify_not_on_freelist(struct bch_fs *c, struct bch_dev *ca,
size_t bucket)
{
- if (expensive_debug_checks(c)) {
+ if (expensive_debug_checks(c) &&
+ test_bit(BCH_FS_ALLOCATOR_STARTED, &c->flags)) {
size_t iter;
long i;
unsigned j;
@@ -1970,6 +1968,8 @@ static int __bch2_fs_allocator_start(struct bch_fs *c)
ca->nr_invalidated--;
}
+ set_bit(BCH_FS_ALLOCATOR_STARTED, &c->flags);
+
/* now flush dirty btree nodes: */
if (invalidating_data) {
struct bucket_table *tbl;