bcachefs: Defer full journal entry validation
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 14 Oct 2022 02:52:40 +0000 (22:52 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:44 +0000 (17:09 -0400)
commitd1b2c864e001c4a709ab040d299c553284bcdb2b
treec4de1b4bfd700766838b9989e8a841c74be15d84
parent17fe3b6452f62c0ee353f3b4f0107685cfd6847d
bcachefs: Defer full journal entry validation

On journal read, previously we would do full journal entry validation
immediately after reading a journal entry.

However, this would lead to errors for journal entries we weren't
actually going to use, either because they were too old or too new
(newer than the most recent flush).

We've observed write tearing on journal entries newer than the newest
flush - which makes sense, prior to a flush there's no guarantees about
write persistence.

This patch defers full journal entry validation until the end of the
journal read path, when we know which journal entries we'll want to use.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal_io.c