Skip to content

Commit a416637

Browse files
adam900710kdave
authored andcommitted
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>
1 parent cb3c11d commit a416637

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fs/btrfs/subpage.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "btrfs_inode.h"
77

88
/*
9-
* Subpage (sectorsize < PAGE_SIZE) support overview:
9+
* Subpage (block size < folio size) support overview:
1010
*
1111
* Limitations:
1212
*
@@ -194,7 +194,7 @@ static void btrfs_subpage_assert(const struct btrfs_fs_info *fs_info,
194194
*/
195195
if (folio->mapping)
196196
ASSERT(folio_pos(folio) <= start &&
197-
start + len <= folio_pos(folio) + PAGE_SIZE);
197+
start + len <= folio_pos(folio) + folio_size(folio));
198198
}
199199

200200
#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)
223223
if (folio_pos(folio) >= orig_start + orig_len)
224224
*len = 0;
225225
else
226-
*len = min_t(u64, folio_pos(folio) + PAGE_SIZE,
226+
*len = min_t(u64, folio_pos(folio) + folio_size(folio),
227227
orig_start + orig_len) - *start;
228228
}
229229

fs/btrfs/subpage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static inline bool btrfs_is_subpage(const struct btrfs_fs_info *fs_info,
8989
{
9090
if (folio->mapping && folio->mapping->host)
9191
ASSERT(is_data_inode(BTRFS_I(folio->mapping->host)));
92-
return fs_info->sectorsize < PAGE_SIZE;
92+
return fs_info->sectorsize < folio_size(folio);
9393
}
9494
#else
9595
static inline bool btrfs_meta_is_subpage(const struct btrfs_fs_info *fs_info)

0 commit comments

Comments
 (0)