bcachefs: Fix journal_keys_search() overhead
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 21 May 2022 17:10:39 +0000 (13:10 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:33 +0000 (17:09 -0400)
commit30525f68633740e071c0960c11c4380f1f6851af
tree161d8051b6025babe27c0e81d7a71babaafa9d86
parent11f5e595bf7cd11c395f0041cdd6448f238a5614
bcachefs: Fix journal_keys_search() overhead

Previously, on every btree_iter_peek() operation we were searching the
journal keys, doing a full binary search - which was slow.

This patch fixes that by saving our position in the journal keys, so
that we only do a full binary search when moving our position backwards
or a large jump forwards.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_types.h
fs/bcachefs/recovery.c
fs/bcachefs/recovery.h