diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-10 00:48:36 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-04-10 14:37:05 -0400 |
commit | 042e242e6294786bbfe1eaf1340a435b5233eed7 (patch) | |
tree | ef766b24e7dae5613be8fb0d1913d5dbcea8b390 | |
parent | dc076838bb89ca2f1fb8b88feb9e2778d6a3ab56 (diff) |
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>
-rw-r--r-- | fs/bcachefs/btree_update_leaf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c index f6eb3199e106..fccfc0b3a8a2 100644 --- a/fs/bcachefs/btree_update_leaf.c +++ b/fs/bcachefs/btree_update_leaf.c @@ -858,10 +858,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); @@ -872,7 +873,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); |