diff mbox series

[RFC,3/8] btrfs: make compress_file_range() to be subpage compatible

Message ID 20210623055529.166678-4-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: experimental compression support for subpage | expand

Commit Message

Qu Wenruo June 23, 2021, 5:55 a.m. UTC
In function compress_file_range(), then the compression is finished, the
function just round 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 <wqu@suse.com>
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e102e3672475..30cb8b1fc067 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -759,7 +759,7 @@  static noinline int compress_file_range(struct async_chunk *async_chunk)
 		 * 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++;