From: Qu Wenruo Date: Mon, 27 Sep 2021 07:21:59 +0000 (+0800) Subject: btrfs: subpage: make compress_file_range() compatible X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4c162778d63eb8822492f715dbe06970d242b4fd;p=linux.git btrfs: subpage: make compress_file_range() compatible In function compress_file_range(), when the compression is finished, the function just rounds up @total_in to PAGE_SIZE. This is fine for regular sectorsize == PAGE_SIZE case, but not for subpage. Just change the ALIGN(, PAGE_SIZE) to round_up(, sectorsize) so that both regular sectorsize and subpage sectorsize will be happy. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index aaeb2192b24d3..dd91f4e60fb63 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -758,7 +758,7 @@ cont: * win, compare the page count read with the blocks on disk, * compression must free at least one sector size */ - total_in = ALIGN(total_in, PAGE_SIZE); + total_in = round_up(total_in, fs_info->sectorsize); if (total_compressed + blocksize <= total_in) { compressed_extents++;