]> www.infradead.org Git - users/willy/xarray.git/commit
bcachefs: Accumulate accounting keys in journal replay
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 28 Dec 2023 01:59:01 +0000 (20:59 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:13 +0000 (19:00 -0400)
commit9dec2a473bd1ba6a111382928e3ceaddfbb720ba
tree2122df657ebc80f6a8d1730f52c84d662289dc6f
parent2744e5c9eb1a1090b5f61c955e934c70bfe6b04c
bcachefs: Accumulate accounting keys in journal replay

Until accounting keys hit the btree, they are deltas, not new versions
of the existing key; this means we have to teach journal replay to
accumulate them.

Additionally, the journal doesn't track precisely which entries have
been flushed to the btree; it only tracks a range of entries that may
possibly still need to be flushed.

That means we need to compare accounting keys against the version in the
btree and only flush updates that are newer.

There's another wrinkle with the write buffer: if the write buffer
starts flushing accounting keys before journal replay has finished
flushing accounting keys, journal replay will see the version number
from the new updates and updates from the journal will be lost.

To avoid this, journal replay has to flush accounting keys first, and
we'll be adding a flag so that write buffer flush knows to hold
accounting keys until then.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_journal_iter.c
fs/bcachefs/btree_journal_iter.h
fs/bcachefs/btree_trans_commit.c
fs/bcachefs/btree_update.h
fs/bcachefs/recovery.c