From: Qu Wenruo Date: Mon, 17 Mar 2025 07:10:48 +0000 (+1030) Subject: btrfs: prepare btrfs_page_mkwrite() for large data folios X-Git-Tag: v6.16-rc1~214^2~158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f45e538b0002bac23a1d2b27002088aa89279b74;p=thirdparty%2Flinux.git btrfs: prepare btrfs_page_mkwrite() for large data folios The function btrfs_page_mkwrite() has an explicit ASSERT() checking the folio order. To make it support large data folios, we need to: - Remove the ASSERT(folio_order(folio) == 0) - Use folio_contains() to check if the folio covers the last page Otherwise the code is already supporting large folios well. Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index cbe98e8251623..d024f31731dc1 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1855,8 +1855,6 @@ static vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) u64 page_end; u64 end; - ASSERT(folio_order(folio) == 0); - reserved_space = fsize; sb_start_pagefault(inode->i_sb); @@ -1921,7 +1919,7 @@ again: goto again; } - if (folio->index == ((size - 1) >> PAGE_SHIFT)) { + if (folio_contains(folio, (size - 1) >> PAGE_SHIFT)) { reserved_space = round_up(size - page_start, fs_info->sectorsize); if (reserved_space < fsize) { end = page_start + reserved_space - 1;