bcachefs: New on disk format: Backpointers
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 18 Mar 2022 00:51:27 +0000 (20:51 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:50 +0000 (17:09 -0400)
commita8c752bb1d93a24a0de753e209d4f4d58d65c878
treec0acc070a99c2c869e535b34be3fdff39ee9bd06
parent920e69bc3db88d3825c69190cafd43f0a1918d3b
bcachefs: New on disk format: Backpointers

This patch adds backpointers: we now have a reverse index from device
and offset on that device (specifically, offset within a bucket) back to
btree nodes and (non cached) data extents.

The first 40 backpointers within a bucket are stored in the alloc key;
after that backpointers spill over to the next backpointers btree. This
is to help avoid performance regressions from additional btree updates
on large streaming workloads.

This patch adds all the code for creating, checking and repairing
backpointers. The next patch in the series is going to use backpointers
for copygc - finally getting rid of the need to scan all extents to do
copygc.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
14 files changed:
fs/bcachefs/Makefile
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.h
fs/bcachefs/alloc_foreground.c
fs/bcachefs/backpointers.c [new file with mode: 0644]
fs/bcachefs/backpointers.h [new file with mode: 0644]
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bkey_methods.c
fs/bcachefs/buckets.c
fs/bcachefs/buckets.h
fs/bcachefs/errcode.h
fs/bcachefs/recovery.c
fs/bcachefs/super.c