bcachefs: Don't trigger extra assertions in journal replay
We now pass a rw argument to .key_invalid methods so they can trigger assertions for updates but not on existing keys. We shouldn't trigger these extra assertions in journal replay - this patch changes the transaction commit path accordingly. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
a9c0a4cbf1
commit
cf0dd697eb
@ -767,9 +767,9 @@ static int bset_key_invalid(struct bch_fs *c, struct btree *b,
|
||||
bool updated_range, int rw,
|
||||
struct printbuf *err)
|
||||
{
|
||||
return __bch2_bkey_invalid(c, k, btree_node_type(b), rw, err) ?:
|
||||
return __bch2_bkey_invalid(c, k, btree_node_type(b), READ, err) ?:
|
||||
(!updated_range ? bch2_bkey_in_btree_node(b, k, err) : 0) ?:
|
||||
(rw == WRITE ? bch2_bkey_val_invalid(c, k, rw, err) : 0);
|
||||
(rw == WRITE ? bch2_bkey_val_invalid(c, k, READ, err) : 0);
|
||||
}
|
||||
|
||||
static int validate_bset_keys(struct bch_fs *c, struct btree *b,
|
||||
|
@ -864,10 +864,11 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans,
|
||||
struct btree_insert_entry *i;
|
||||
struct printbuf buf = PRINTBUF;
|
||||
int ret, u64s_delta = 0;
|
||||
int rw = (trans->flags & BTREE_INSERT_JOURNAL_REPLAY) ? READ : WRITE;
|
||||
|
||||
trans_for_each_update(trans, i) {
|
||||
if (bch2_bkey_invalid(c, bkey_i_to_s_c(i->k),
|
||||
i->bkey_type, WRITE, &buf)) {
|
||||
i->bkey_type, rw, &buf)) {
|
||||
printbuf_reset(&buf);
|
||||
pr_buf(&buf, "invalid bkey on insert from %s -> %ps",
|
||||
trans->fn, (void *) i->ip_allocated);
|
||||
@ -878,7 +879,7 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans,
|
||||
pr_newline(&buf);
|
||||
|
||||
bch2_bkey_invalid(c, bkey_i_to_s_c(i->k),
|
||||
i->bkey_type, WRITE, &buf);
|
||||
i->bkey_type, rw, &buf);
|
||||
|
||||
bch2_trans_inconsistent(trans, "%s", buf.buf);
|
||||
printbuf_exit(&buf);
|
||||
|
Loading…
Reference in New Issue
Block a user