bcachefs: mark journal replicas before journal write submission
authorBrian Foster <bfoster@redhat.com>
Thu, 4 May 2023 16:44:15 +0000 (12:44 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:01 +0000 (17:10 -0400)
commita7b29b8d9a17297499a409274e75d674e7930ff9
tree30415902f3d7938177be647decbb2fdbb369e9b9
parent38e3d93fa1da7e3f0bc61b240a65cee7fb024400
bcachefs: mark journal replicas before journal write submission

The journal write submission path marks the associated replica
entries for journal data in journal_write_done(), which is just
after journal write bio submission. This creates a small window
where journal entries might have been written out, but the
associated replica is not marked such that recovery does not know
that the associated device contains journal data.

Move the replica marking a bit earlier in the write path such that
recovery is guaranteed to recognize that the device contains journal
data in the event of a crash.

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