Update bcachefs sources to 2152e671d8 bcachefs: Add a bit of missing repair code

This commit is contained in:
Kent Overstreet 2021-11-21 14:55:54 -05:00
parent 837b76ce95
commit 50bc63a6ce
2 changed files with 15 additions and 1 deletions

View File

@ -1 +1 @@
70b5fb5dafe66482c0d09a37bd547f56ef645bc4
2152e671d805a531496b649b593e0a1918069d84

View File

@ -498,6 +498,10 @@ static int bch2_check_fix_ptrs(struct bch_fs *c, enum btree_id btree_id,
char buf[200];
int ret = 0;
/*
* XXX
* use check_bucket_ref here
*/
bkey_for_each_ptr_decode(k->k, ptrs, p, entry) {
struct bch_dev *ca = bch_dev_bkey_exists(c, p.ptr.dev);
struct bucket *g = PTR_BUCKET(ca, &p.ptr, true);
@ -553,6 +557,15 @@ static int bch2_check_fix_ptrs(struct bch_fs *c, enum btree_id btree_id,
}
}
if (fsck_err_on(gen_cmp(g->mark.gen, p.ptr.gen) > BUCKET_GC_GEN_MAX, c,
"bucket %u:%zu gen %u data type %s: ptr gen %u too stale\n"
"while marking %s",
p.ptr.dev, PTR_BUCKET_NR(ca, &p.ptr), g->mark.gen,
bch2_data_types[ptr_data_type(k->k, &p.ptr)],
p.ptr.gen,
(bch2_bkey_val_to_text(&PBUF(buf), c, *k), buf)))
do_update = true;
if (fsck_err_on(!p.ptr.cached &&
gen_cmp(p.ptr.gen, g->mark.gen) < 0, c,
"bucket %u:%zu data type %s stale dirty ptr: %u < %u\n"
@ -644,6 +657,7 @@ static int bch2_check_fix_ptrs(struct bch_fs *c, enum btree_id btree_id,
(!g->gen_valid || gen_cmp(ptr->gen, g->mark.gen) > 0)) ||
(!ptr->cached &&
gen_cmp(ptr->gen, g->mark.gen) < 0) ||
gen_cmp(g->mark.gen, ptr->gen) > BUCKET_GC_GEN_MAX ||
(g->mark.data_type &&
g->mark.data_type != data_type);
}));