]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: Implement bch2_btree_iter_prev_min()
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 25 Oct 2024 02:12:37 +0000 (22:12 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:18 +0000 (01:36 -0500)
commit7e5b8e00e2631ee1fa72edeb420e7393ad078ab3
tree0b33351328ad05ca3531055a7364181fa86e0d28
parentacd1fc7b1fb7585780b55edc79b4ee3bfd5ee1ce
bcachefs: Implement bch2_btree_iter_prev_min()

A user contributed a filessytem dump, where the dump was actually
corrupted (due to being taken while the filesystem was online), but
which exposed an interesting bug in fsck - reconstruct_inode().

When itearting in BTREE_ITER_filter_snapshots mode, it's required to
give an end position for the iteration and it can't span inode numbers;
continuing into the next inode might mean we start seeing keys from a
different snapshot tree, that the is_ancestor() checks always filter,
thus we're never able to return a key and stop iterating.

Backwards iteration never implemented the end position because nothing
else needed it - except for reconstuct_inode().

Additionally, backwards iteration is now able to overlay keys from the
journal, which will be useful if we ever decide to start doing journal
replay in the background.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_journal_iter.c
fs/bcachefs/btree_journal_iter.h
fs/bcachefs/errcode.h
fs/bcachefs/fsck.c
fs/bcachefs/io_misc.c