bcachefs: Improved extent merging
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 15 May 2021 04:37:37 +0000 (00:37 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:06 +0000 (17:09 -0400)
commitc2177e4da332df6fb91b08b874a79051f13897bc
tree3f376ac911566542dd019ef6cf7ad051071e0aa6
parent5db95e50e11bdd0a191a22fdbc1e68ec900aff89
bcachefs: Improved extent merging

Previously, checksummed extents could only be merged when the checksum
covered only the currently live data.

xfstest generic/064 creates a test file, then uses finsert calls to
split the extent, then collapse calls to see if they get merged. But
without any reads to trigger the narrow_crcs path, each of the split
extents will still have a checksum for the entire original extent.

This patch improves the extent merge path so that if either of the
extents we're attempting to merge has a checksum that covers the entire
merged extent, we just use that checksum.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/extents.c