]> git.dujemihanovic.xyz Git - linux.git/commit
bcachefs: Rework btree node pinning
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 5 Sep 2024 00:49:37 +0000 (20:49 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Sep 2024 15:39:48 +0000 (11:39 -0400)
commit7a51608d0125469664e2daf8e060d6d783924c98
tree4fa41c4ed7b94e602ad97f8ed73da7e4b56f6893
parent91ddd7151000c0e538cec7fb2f3f86e2268af4d4
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>
fs/bcachefs/backpointers.c
fs/bcachefs/btree_cache.c
fs/bcachefs/btree_cache.h
fs/bcachefs/btree_types.h
fs/bcachefs/btree_update_interior.c
fs/bcachefs/journal_reclaim.c
fs/bcachefs/sysfs.c