btrfs: assert we can NOCOW the range in btrfs_truncate_block()
authorFilipe Manana <fdmanana@suse.com>
Wed, 9 Jul 2025 15:26:13 +0000 (16:26 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 22:09:22 +0000 (00:09 +0200)
commit68e0fcc3617b7a61ab93eeb6d8b935046d152685
tree42cf7164e976b2dcb03804e1e220e788e6178119
parentc6482cff95c77a3c1fc0120c6e8ef7b15f85439b
btrfs: assert we can NOCOW the range in btrfs_truncate_block()

We call btrfs_check_nocow_lock() to see if we can NOCOW a block sized
range but we don't check later if we can NOCOW the whole range.
It's unexpected to be able to NOCOW a range smaller than blocksize, so
add an assertion to check the NOCOW range matches the blocksize.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c