summaryrefslogtreecommitdiff
path: root/fs/bcachefs/backpointers.c
AgeCommit message (Collapse)Author
2022-10-04backpointer assertionsbackpointer_debugKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2022-10-03bcachefs: Fix bch2_backpointer_get_key()Kent Overstreet
We weren't returning -BCH_ERR_backpointer_to_overwritten_btree_node from bch2_backpointer_get_node - oops. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2022-10-03bcachefs: Fix spurious "backpointer doesn't match" error in fsckKent Overstreet
New btree nodes dont't have allocation information written until the node has been written, which means there's a race where the backpointer for the old node points to a node that no longer exists. bch2_backpointer_get_node() checks for this, but fsck uses bch2_backpointer_get_key(); this patch updates bch2_backpointer_get_key() to call get_node() on not found to Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-10-03bcachefs: Ratelimit backpointer_not_found error messageKent Overstreet
This is a no brainer, and makes the output of some of our tests easier to manage. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-10-03bcachefs: Convert bch2_check_btree_backpointers() to for_each_btree_key2()Kent Overstreet
The new for_each_btree_key2() macro handles transaction retries, allowing us to avoid nested transactions - which we want to avoid since they're tricky to do completely correctly and upcoming assertions are going to be checking for that. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-10-03bcachefs: bch2_get_next_backpointer() -> for_each_btree_key_norestart()Kent Overstreet
We shouldn't be using for_each_btree_key() here, we're always called from contexts that already handle transaction restarts. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-10-03bcachefs: Rename __bch2_trans_do() -> commit_do()Kent Overstreet
Better/more descriptive naming, and prep for adding nested_lockrestart_do() and nested_commit_do(). Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-10-03bcachefs: Silence some fsck errors when reconstructing alloc infoKent Overstreet
There's no need to print fsck errors for errors that are expected, and the user has already opted to repair. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-10-03bcachefs: New on disk format: BackpointersKent Overstreet
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@gmail.com>