]> git.hungrycats.org Git - bees/commit
bees: adjust BLOCK_SIZE_MAX_EXTENT to work around kernel bug
authorZygo Blaxell <bees@furryterror.org>
Sat, 14 Feb 2026 05:05:29 +0000 (00:05 -0500)
committerZygo Blaxell <bees@furryterror.org>
Sat, 14 Feb 2026 05:23:07 +0000 (00:23 -0500)
commitb8086fb41af052bdadf35dc13382604e246dc12c
treeaf5724a06b0e2b71d61cd26598e33bced939fae5
parent14c82dce8a7e9714d6f9cd03229e0fb55460aa25
bees: adjust BLOCK_SIZE_MAX_EXTENT to work around kernel bug

In kernel commit 24542bf7ea5e4fdfdb5157ff544c093fa4dcb536 ("btrfs:
limit fallocate extent reservation to 256MB"), the maximum size of a
prealloc extent is set to 256MB.  This exceeds BTRFS_MAX_EXTENT_SIZE,
which is 128MB.

This causes some problems with parts of bees code which guard against
problems that arise when metadata is corrupted.  One manifestation of
that problem is a potential infinite (or very large finite) loop, caused
by the extent mapping code repeatedly trying to compute a dedupe solution
for a >128M extent, but being unable to do so because it is interrupted
when it hits the self-imposed 128M extent size limit.  This may be the
cause of issues such as [#325](https://github.com/Zygo/bees/issues/325).

Since the kernel bug is 14 years old, it's de facto part of the
filesystem spec now.  Increase the limit to the largest expected size
of btrfs extents.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees.h