bcachefs: Fix bch2_check_alloc_key()

bch2_check_alloc_key() was failing to check buckets that didn't have
alloc keys yet (because they'd never been used) - they still need to be
added to the freespace btree.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-06-26 20:34:34 -04:00 committed by Kent Overstreet
parent e34da43e33
commit 47ab0c5f6a

View File

@ -618,7 +618,9 @@ static int bch2_check_alloc_key(struct btree_trans *trans,
struct printbuf buf = PRINTBUF;
int ret;
alloc_k = bch2_btree_iter_peek(alloc_iter);
alloc_k = bch2_dev_bucket_exists(c, alloc_iter->pos)
? bch2_btree_iter_peek_slot(alloc_iter)
: bch2_btree_iter_peek(alloc_iter);
if (!alloc_k.k)
return 1;