bcachefs: Btree key cache coherency
authorKent Overstreet <kent.overstreet@gmail.com>
Wed, 12 Jan 2022 06:14:47 +0000 (01:14 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:23 +0000 (17:09 -0400)
commit12ce5b7df1e0e432bcac22079e4493cab5cd8b23
tree26c734e453b9a614bc05dc7c42db3dd45affb479
parentf7b6ca23b6456b8b441b506ef977ff53972b35c2
bcachefs: Btree key cache coherency

 - Updates to non key cache iterators will now be transparently
   redirected to the key cache for cached btrees.

 - Except when creating new keys: then the update goes to underlying
   btree

For for iterating over a cached btree to work, we need to ensure that if
a key exists in the key cache, it also exists in the btree - otherwise
the iterator code will skip past it and not check the key cache.

Otherwise, for consistency, all updates should go to the same place -
the key cache.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_key_cache.c
fs/bcachefs/btree_key_cache.h
fs/bcachefs/btree_types.h
fs/bcachefs/btree_update.h
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/trace.h