btrfs: replace PAGE_SIZE with folio_size for subpage.[ch]

Since we can no longer assume all data filemap folios are page sized,
use proper folio_size() calls to determine the folio size, as a
preparation for future large data filemap folios.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2025-03-10 13:50:43 +10:30 committed by David Sterba
parent cb3c11d2f5
commit a416637f90
2 changed files with 4 additions and 4 deletions

View file

@ -6,7 +6,7 @@
#include "btrfs_inode.h"
/*
* Subpage (sectorsize < PAGE_SIZE) support overview:
* Subpage (block size < folio size) support overview:
*
* Limitations:
*
@ -194,7 +194,7 @@ static void btrfs_subpage_assert(const struct btrfs_fs_info *fs_info,
*/
if (folio->mapping)
ASSERT(folio_pos(folio) <= start &&
start + len <= folio_pos(folio) + PAGE_SIZE);
start + len <= folio_pos(folio) + folio_size(folio));
}
#define subpage_calc_start_bit(fs_info, folio, name, start, len) \
@ -223,7 +223,7 @@ static void btrfs_subpage_clamp_range(struct folio *folio, u64 *start, u32 *len)
if (folio_pos(folio) >= orig_start + orig_len)
*len = 0;
else
*len = min_t(u64, folio_pos(folio) + PAGE_SIZE,
*len = min_t(u64, folio_pos(folio) + folio_size(folio),
orig_start + orig_len) - *start;
}

View file

@ -89,7 +89,7 @@ static inline bool btrfs_is_subpage(const struct btrfs_fs_info *fs_info,
{
if (folio->mapping && folio->mapping->host)
ASSERT(is_data_inode(BTRFS_I(folio->mapping->host)));
return fs_info->sectorsize < PAGE_SIZE;
return fs_info->sectorsize < folio_size(folio);
}
#else
static inline bool btrfs_meta_is_subpage(const struct btrfs_fs_info *fs_info)