bcachefs: Fix CPU usage in journal read path
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 10 Apr 2022 20:26:34 +0000 (16:26 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:31 +0000 (17:09 -0400)
commitec7ccbde6baa50760c2679a5c54b2fccfd5ca64e
treea59ef7beb956d77ed30111667fada52a92807902
parent6e811bbbc2ea3b20854c45fa29811640881bb534
bcachefs: Fix CPU usage in journal read path

In journal_entry_add(), we were repeatedly scanning the journal entries
radix tree to scan for old entries that can be freed, with O(n^2)
behaviour. This patch tweaks things to remember the previous last_seq,
so we don't have to scan for entries to free from the start.

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