bcachefs: Fix is_ancestor bitmap
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 13 Jul 2023 06:43:29 +0000 (02:43 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:11 +0000 (17:10 -0400)
commit66487c54ad8207ef1c029df45ffaeaafbcc11f77
tree4d88aa0241e4bd202877f970fdeec86a9e1b6d5e
parentfa5bed376a184f2dcb48dba5c076583ed6c61340
bcachefs: Fix is_ancestor bitmap

The is_ancestor bitmap is at optimization for bch2_snapshot_is_ancestor;
once we get sufficiently close to the ancestor ID we're searching for we
test a bitmap.

But initialization of the is_ancestor bitmap was broken; we do it by
using bch2_snapshot_parent(), but we call that on nodes that haven't
been initialized yet with bch2_mark_snapshot().

Fix this by adding a separate loop in bch2_snapshots_read() for
initializing the is_ancestor bitmap, and also add some new debug asserts
for checking this sort of breakage in the future.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/snapshot.c