diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-01-12 01:14:47 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:23 -0400 |
commit | 12ce5b7df1e0e432bcac22079e4493cab5cd8b23 (patch) | |
tree | 26c734e453b9a614bc05dc7c42db3dd45affb479 /fs/bcachefs/btree_types.h | |
parent | bcachefs: BTREE_ITER_WITH_KEY_CACHE (diff) | |
download | linux-12ce5b7df1e0e432bcac22079e4493cab5cd8b23.tar.gz linux-12ce5b7df1e0e432bcac22079e4493cab5cd8b23.tar.bz2 linux-12ce5b7df1e0e432bcac22079e4493cab5cd8b23.zip |
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>
Diffstat (limited to 'fs/bcachefs/btree_types.h')
-rw-r--r-- | fs/bcachefs/btree_types.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index 6db2ac49ee3f..0afade4f61f4 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -344,6 +344,7 @@ struct btree_insert_entry { bool cached:1; bool insert_trigger_run:1; bool overwrite_trigger_run:1; + bool key_cache_already_flushed:1; /* * @old_k may be a key from the journal; @old_btree_u64s always refers * to the size of the key being overwritten in the btree: @@ -645,6 +646,8 @@ static inline bool btree_type_has_snapshots(enum btree_id id) enum btree_update_flags { __BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE, __BTREE_UPDATE_NOJOURNAL, + __BTREE_UPDATE_KEY_CACHE_RECLAIM, + __BTREE_UPDATE_NO_KEY_CACHE_COHERENCY, __BTREE_TRIGGER_NORUN, /* Don't run triggers at all */ @@ -658,6 +661,9 @@ enum btree_update_flags { #define BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE (1U << __BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE) #define BTREE_UPDATE_NOJOURNAL (1U << __BTREE_UPDATE_NOJOURNAL) +#define BTREE_UPDATE_KEY_CACHE_RECLAIM (1U << __BTREE_UPDATE_KEY_CACHE_RECLAIM) +#define BTREE_UPDATE_NO_KEY_CACHE_COHERENCY \ + (1U << __BTREE_UPDATE_NO_KEY_CACHE_COHERENCY) #define BTREE_TRIGGER_NORUN (1U << __BTREE_TRIGGER_NORUN) |