diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-09-05 02:49:37 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-09-21 17:39:48 +0200 |
commit | 7a51608d0125469664e2daf8e060d6d783924c98 (patch) | |
tree | 4fa41c4ed7b94e602ad97f8ed73da7e4b56f6893 /fs/bcachefs/btree_cache.h | |
parent | bcachefs: split up btree cache counters for live, freeable (diff) | |
download | linux-7a51608d0125469664e2daf8e060d6d783924c98.tar.xz linux-7a51608d0125469664e2daf8e060d6d783924c98.zip |
bcachefs: Rework btree node pinning
In backpointers fsck, we do a seqential scan of one btree, and check
references to another: extents <-> backpointers
Checking references generates random lookups, so we want to pin that
btree in memory (or only a range, if it doesn't fit in ram).
Previously, this was done with a simple check in the shrinker - "if
btree node is in range being pinned, don't free it" - but this generated
OOMs, as our shrinker wasn't well behaved if there was less memory
available than expected.
Instead, we now have two different shrinkers and lru lists; the second
shrinker being for pinned nodes, with seeks set much higher than normal
- so they can still be freed if necessary, but we'll prefer not to.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_cache.h')
-rw-r--r-- | fs/bcachefs/btree_cache.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_cache.h b/fs/bcachefs/btree_cache.h index f82064007127..367acd217c6a 100644 --- a/fs/bcachefs/btree_cache.h +++ b/fs/bcachefs/btree_cache.h @@ -19,6 +19,9 @@ int __bch2_btree_node_hash_insert(struct btree_cache *, struct btree *); int bch2_btree_node_hash_insert(struct btree_cache *, struct btree *, unsigned, enum btree_id); +void bch2_node_pin(struct bch_fs *, struct btree *); +void bch2_btree_cache_unpin(struct bch_fs *); + void bch2_btree_node_update_key_early(struct btree_trans *, enum btree_id, unsigned, struct bkey_s_c, struct bkey_i *); |