From: Filipe Manana <fdmanana@xxxxxxxx> Hi, This short series allows deduplication of the last block of a file when the eof is not aligned to the sector size, as long as the range's end offset matches the eof of the destination file. This is a safe case unlike the case where we attempt to clone the block in the middle of a file (which results in a corruption I found last year and affected both btrfs and xfs). This is motivated by btrfs users reporting lower deduplication scores starting with kernel 5.0, which was the kernel release where btrfs was changed to use the generic VFS helper generic_remap_file_range_prep(). Users observed that the last block was no longer deduplicated when a file's size is not block size aligned. For btrfs this is specially important because references are kept per extent and not per block, so not having the last block deduplicated means the entire extent is kept allocated, making the deduplication not effective and often pointless in many cases. Thanks. Filipe Manana (2): fs: allow deduplication of eof block into the end of the destination file Btrfs: make deduplication with range including the last block work fs/btrfs/ioctl.c | 3 ++- fs/read_write.c | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) -- 2.11.0