Thread (30 messages) 30 messages, 3 authors, 2025-02-21

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

From: Matthew Wilcox <willy@infradead.org>
Date: 2025-02-21 20:27:22
Also in: linux-fsdevel, linux-mm, linux-xfs

On Fri, Feb 21, 2025 at 10:58:58AM -0800, Luis Chamberlain wrote:
quoted hunk ↗ jump to hunk
+++ 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help