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 <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
        u64 page_end;
        u64 end;
 
-       ASSERT(folio_order(folio) == 0);
-
        reserved_space = fsize;
 
        sb_start_pagefault(inode->i_sb);
                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;