On Fri, Feb 21, 2025 at 08:27:17PM +0000, Matthew Wilcox wrote: > On Fri, Feb 21, 2025 at 10:58:58AM -0800, Luis Chamberlain wrote: > > +++ b/fs/mpage.c > > @@ -152,6 +152,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) > > { > > struct folio *folio = args->folio; > > struct inode *inode = folio->mapping->host; > > + const unsigned min_nrpages = mapping_min_folio_nrpages(folio->mapping); > > const unsigned blkbits = inode->i_blkbits; > > const unsigned blocks_per_folio = folio_size(folio) >> blkbits; > > const unsigned blocksize = 1 << blkbits; > > @@ -172,6 +173,8 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) > > > > /* MAX_BUF_PER_PAGE, for example */ > > VM_BUG_ON_FOLIO(folio_test_large(folio), folio); > > + VM_BUG_ON_FOLIO(args->nr_pages < min_nrpages, folio); > > + VM_BUG_ON_FOLIO(!IS_ALIGNED(args->nr_pages, min_nrpages), folio); > > > > if (args->is_readahead) { > > opf |= REQ_RAHEAD; > > Also, I don't think these assertions add any value; we already assert > these things are true in other places. Sure, it may not have been clear to others but that doesn't mean we need to be explicit about that in code, the commit log can justify this alone. Will remove. Luis