Message ID | 428b3c09f6df2820865640e2cf91a7cc0c1b4119.1743113694.git.wqu@suse.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | btrfs: add the missing preparations exposed by initial large data folio support | expand |
On Thu, Mar 27, 2025 at 10:33 PM Qu Wenruo <wqu@suse.com> wrote: > > Inside the macro, subpage_calc_start_bit(), we needs 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. > > Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Looks good, thanks. > --- > fs/btrfs/subpage.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/btrfs/subpage.c b/fs/btrfs/subpage.c > index 5b69c447fec9..5fbdd977121e 100644 > --- a/fs/btrfs/subpage.c > +++ b/fs/btrfs/subpage.c > @@ -202,7 +202,7 @@ static void btrfs_subpage_assert(const struct btrfs_fs_info *fs_info, > btrfs_blocks_per_folio(fs_info, folio); \ > \ > btrfs_subpage_assert(fs_info, folio, start, len); \ > - __start_bit = offset_in_page(start) >> fs_info->sectorsize_bits; \ > + __start_bit = offset_in_folio(folio, start) >> fs_info->sectorsize_bits; \ > __start_bit += blocks_per_folio * btrfs_bitmap_nr_##name; \ > __start_bit; \ > }) > -- > 2.49.0 > >
diff --git a/fs/btrfs/subpage.c b/fs/btrfs/subpage.c index 5b69c447fec9..5fbdd977121e 100644 --- a/fs/btrfs/subpage.c +++ b/fs/btrfs/subpage.c @@ -202,7 +202,7 @@ static void btrfs_subpage_assert(const struct btrfs_fs_info *fs_info, btrfs_blocks_per_folio(fs_info, folio); \ \ btrfs_subpage_assert(fs_info, folio, start, len); \ - __start_bit = offset_in_page(start) >> fs_info->sectorsize_bits; \ + __start_bit = offset_in_folio(folio, start) >> fs_info->sectorsize_bits; \ __start_bit += blocks_per_folio * btrfs_bitmap_nr_##name; \ __start_bit; \ })
Inside the macro, subpage_calc_start_bit(), we needs 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. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/subpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)