Update bcachefs sources to 7786034caa bcachefs: Fix for freespace version upgrade path

This commit is contained in:
Kent Overstreet 2022-03-28 18:44:48 -04:00
parent fd249e130f
commit 61d31d7a02
3 changed files with 14 additions and 4 deletions

View File

@ -1 +1 @@
bba7493dda9d1a0a9741fff88aff2228af3f4fc0
7786034caa4ee7d10d25202284220513c0944ce2

View File

@ -724,12 +724,23 @@ int bch2_check_alloc_info(struct bch_fs *c, bool initial)
struct btree_trans trans;
struct btree_iter iter;
struct bkey_s_c k;
int ret = 0;
int ret = 0, last_dev = -1;
bch2_trans_init(&trans, c, 0, 0);
for_each_btree_key(&trans, iter, BTREE_ID_alloc, POS_MIN,
BTREE_ITER_PREFETCH, k, ret) {
if (k.k->p.inode != last_dev) {
struct bch_dev *ca = bch_dev_bkey_exists(c, k.k->p.inode);
if (!ca->mi.freespace_initialized) {
bch2_btree_iter_set_pos(&iter, POS(k.k->p.inode + 1, 0));
continue;
}
last_dev = k.k->p.inode;
}
ret = __bch2_trans_do(&trans, NULL, NULL, 0,
bch2_check_alloc_key(&trans, &iter));
if (ret)

View File

@ -1174,8 +1174,7 @@ use_clean:
bch_verbose(c, "done checking allocations");
}
if (c->opts.fsck &&
c->sb.version >= bcachefs_metadata_version_freespace) {
if (c->opts.fsck) {
bch_info(c, "checking need_discard and freespace btrees");
err = "error checking need_discard and freespace btrees";
ret = bch2_check_alloc_info(c, true);