Skip to content

Commit cf6ae7e

Browse files
adam900710kdave
authored andcommitted
btrfs: subpage: access correct object when reading bitmap start in subpage_calc_start_bit()
Inside the macro, subpage_calc_start_bit(), we need to calculate the offset to the beginning of the folio. But we're using offset_in_page(), on systems with 4K page size and 4K fs block size, this means we will always return offset 0 for a large folio, causing all kinds of errors. Fix it by using offset_in_folio() instead. Reviewed-by: Filipe Manana <fdmanana@suse.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 65f2a3b commit cf6ae7e

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
@@ -204,7 +204,7 @@ static void btrfs_subpage_assert(const struct btrfs_fs_info *fs_info,
204204
btrfs_blocks_per_folio(fs_info, folio); \
205205
\
206206
btrfs_subpage_assert(fs_info, folio, start, len); \
207-
__start_bit = offset_in_page(start) >> fs_info->sectorsize_bits; \
207+
__start_bit = offset_in_folio(folio, start) >> fs_info->sectorsize_bits; \
208208
__start_bit += blocks_per_folio * btrfs_bitmap_nr_##name; \
209209
__start_bit; \
210210
})

0 commit comments

Comments
 (0)