bcachefs: Fix rereplicate when we already have a cached pointer
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 8 Jan 2023 03:55:42 +0000 (22:55 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:49 +0000 (17:09 -0400)
commitd7dd3fb84f05a0d221be3979929706a4828fb252
treebc7b4e773bebdd65fe51f2fe1a36579cc5ead714
parent7c909f654bae57083a0965f105e52ac8737a0785
bcachefs: Fix rereplicate when we already have a cached pointer

When we need to add more replicas to an extent, it might be the case
that we already have a replica on every device, but some of them are
cached.

This patch fixes a bug where we'd spin on that extent because the write
path fails to find a device we can allocate from: we allow allocating
from devices that already have cached replicas on them, and change
bch2_data_update_index_update() to drop the cached replica if needed.

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