bcachefs: remove bucket_gens btree keys on device removal
authorBrian Foster <bfoster@redhat.com>
Wed, 19 Apr 2023 15:47:03 +0000 (11:47 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:00 +0000 (17:10 -0400)
commit02d51bb9a7315eb569a160363058ca2cd140faa1
tree2352da4077c23a297e02d02a61efdc0a5c85d4df
parent251babb55d53d79bba9568d6516fd11128c34606
bcachefs: remove bucket_gens btree keys on device removal

If a device has keys in the bucket_gens btree associated with its
buckets and is removed from a bcachefs volume, fsck will complain
about the presence of keys associated with an invalid device index.
A repair removes the associated keys and restores correctness.
Update bch2_dev_remove_alloc() to remove device related keys at
device removal time to avoid the problem.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/super.c