]> git.hungrycats.org Git - bees/commit
roots: filter out NODATASUM files before attempting to scan them
authorZygo Blaxell <bees@furryterror.org>
Wed, 9 Jul 2025 05:33:31 +0000 (01:33 -0400)
committerZygo Blaxell <bees@furryterror.org>
Tue, 22 Jul 2025 01:21:54 +0000 (21:21 -0400)
commit27b5b4e11361d4f0faac87d61cd8b420ce1096ca
treef95c8f83ed299245383e9f2b4a898142aeb253c1
parente9e6870de89a00d483bfb18f412a5273bb5650f0
roots: filter out NODATASUM files before attempting to scan them

Add a cheap check for `FS_NOCOW_FL` when we first encounter
each extent.  In the raw btrfs inode flags, the offending flag is
`BTRFS_INODE_NODATASUM`, because the restriction that prevents reflink
between datacow and "nodatacow" files is that a single inode is allowed
to have csums or not have csums, but must apply that choice to _all_
of its extents.

This extra check is cheaper than opening a file for each individual
reference to the extent, and then discovering that the file is
`FS_NOCOW_FL`, and then closing the file, over and over again.  It will
also avoid emitting a lot of noisy log messages.

Fixes: https://github.com/Zygo/bees/issues/313
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-roots.cc