Re: [PATCH v2 4/8] fs/mpage: use blocks_per_folio instead of blocks_per_page

Matthew Wilcox
2025-02-17T21:58:27Z

On Tue, Feb 04, 2025 at 03:12:05PM -0800, Luis Chamberlain wrote:
> @@ -182,7 +182,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args)
> goto confused;
>
> block_in_file = folio_pos(folio) >> blkbits;
> - last_block = block_in_file + args->nr_pages * blocks_per_page;
> + last_block = block_in_file + args->nr_pages * blocks_per_folio;

In mpage_readahead(), we set args->nr_pages to the nunber of pages (not
folios) being requested. In mpage_read_folio() we currently set it to
1. So this is going to read too far ahead for readahead if using large
folios.

I think we need to make nr_pages continue to mean nr_pages. Or we pass
in nr_bytes or nr_blocks.