Skip to content

Commit 7d82240

Browse files
adam900710kdave
authored andcommitted
btrfs: fix the ASSERT() inside GET_SUBPAGE_BITMAP()
After enabling large data folios for tests, I hit the ASSERT() inside GET_SUBPAGE_BITMAP() where blocks_per_folio matches BITS_PER_LONG. The ASSERT() itself is only based on the original subpage fs block size, where we have at most 16 blocks per page, thus "ASSERT(blocks_per_folio < BITS_PER_LONG)". However the experimental large data folio support will set the max folio order according to the BITS_PER_LONG, so we can have a case where a large folio contains exactly BITS_PER_LONG blocks. So the ASSERT() is too strict, change it to "ASSERT(blocks_per_folio <= BITS_PER_LONG)" to avoid the false alert. Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me> Reviewed-by: Boris Burkov <boris@bur.io> 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 bc2dbc4 commit 7d82240

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/subpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ IMPLEMENT_BTRFS_PAGE_OPS(checked, folio_set_checked, folio_clear_checked,
666666
btrfs_blocks_per_folio(fs_info, folio); \
667667
const struct btrfs_subpage *subpage = folio_get_private(folio); \
668668
\
669-
ASSERT(blocks_per_folio < BITS_PER_LONG); \
669+
ASSERT(blocks_per_folio <= BITS_PER_LONG); \
670670
*dst = bitmap_read(subpage->bitmaps, \
671671
blocks_per_folio * btrfs_bitmap_nr_##name, \
672672
blocks_per_folio); \

0 commit comments

Comments
 (0)