bcachefs: Rework lru btree
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 5 Dec 2022 21:49:13 +0000 (16:49 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:52 +0000 (17:09 -0400)
commit83f33d686553c5105ff36da4dd554c34125094e9
tree3ec96acbfeb14d67d96f027fb7d888f1156cd200
parent350175bf9b0fe5da12a2fd8bfd453a49f038ceb4
bcachefs: Rework lru btree

This patch changes how the LRU index works:

Instead of using KEY_TYPE_lru where the bucket the lru entry points to
is part of the value, this switches to KEY_TYPE_set and encoding the
bucket we refer to in the low bits of the key.

This means that we no longer have to check for collisions when inserting
LRU entries. We'll be making using of this in the next patch, which adds
a btree write buffer - a pure write buffer for btree updates, where
updates are appended to a simple array and then periodically sorted and
batch inserted.

This is a new on disk format version, and a forced upgrade.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_background.c
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bkey_methods.c
fs/bcachefs/lru.c
fs/bcachefs/lru.h
fs/bcachefs/recovery.c