]> www.infradead.org Git - users/willy/pagecache.git/commit
bcachefs: Split out journal pins by btree level
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 10 Feb 2025 16:34:59 +0000 (11:34 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 11 Feb 2025 15:10:32 +0000 (10:10 -0500)
commit1e690efa72596a1163dc56709707f459221889d2
tree9f9b1197a4453f502fa10eb8ea71ac5ce420fefd
parent1c316eb57c11fb3dc447b04ef765459cd61c8647
bcachefs: Split out journal pins by btree level

This lets us flush the journal to go read-only more effectively.

Flushing the journal and going read-only requires halting mutually
recursive processes, which strictly speaking are not guaranteed to
terminate.

Flushing btree node journal pins will kick off a btree node write, and
btree node writes on completion must do another btree update to the
parent node to update the 'sectors_written' field for that node's key.

If the parent node is full and requires a split or compaction, that's
going to generate a whole bunch of additional btree updates - alloc
info, LRU btree, and more - which then have to be flushed, and the cycle
repeats.

This process will terminate much more effectively if we tweak journal
reclaim to flush btree updates leaf to root: i.e., don't flush updates
for a given btree node (kicking off a write, and consuming space within
that node up to the next block boundary) if there might still be
unflushed updates in child nodes.

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