Commit f132ab7d authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle)
Browse files

fs: Convert mpage_readpage to mpage_read_folio



mpage_readpage still works in terms of pages, and has not been audited
for correctness with large folios, so include an assertion that the
filesystem is not passing it large folios.  Convert all the filesystems
to call mpage_read_folio() instead of mpage_readpage().

Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
parent 2c69e205
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -357,9 +357,9 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,
	return err;
}

static int exfat_readpage(struct file *file, struct page *page)
static int exfat_read_folio(struct file *file, struct folio *folio)
{
	return mpage_readpage(page, exfat_get_block);
	return mpage_read_folio(folio, exfat_get_block);
}

static void exfat_readahead(struct readahead_control *rac)
@@ -492,7 +492,7 @@ int exfat_block_truncate_page(struct inode *inode, loff_t from)
static const struct address_space_operations exfat_aops = {
	.dirty_folio	= block_dirty_folio,
	.invalidate_folio = block_invalidate_folio,
	.readpage	= exfat_readpage,
	.read_folio	= exfat_read_folio,
	.readahead	= exfat_readahead,
	.writepage	= exfat_writepage,
	.writepages	= exfat_writepages,
+4 −4
Original line number Diff line number Diff line
@@ -875,9 +875,9 @@ static int ext2_writepage(struct page *page, struct writeback_control *wbc)
	return block_write_full_page(page, ext2_get_block, wbc);
}

static int ext2_readpage(struct file *file, struct page *page)
static int ext2_read_folio(struct file *file, struct folio *folio)
{
	return mpage_readpage(page, ext2_get_block);
	return mpage_read_folio(folio, ext2_get_block);
}

static void ext2_readahead(struct readahead_control *rac)
@@ -966,7 +966,7 @@ ext2_dax_writepages(struct address_space *mapping, struct writeback_control *wbc
const struct address_space_operations ext2_aops = {
	.dirty_folio		= block_dirty_folio,
	.invalidate_folio	= block_invalidate_folio,
	.readpage		= ext2_readpage,
	.read_folio		= ext2_read_folio,
	.readahead		= ext2_readahead,
	.writepage		= ext2_writepage,
	.write_begin		= ext2_write_begin,
@@ -982,7 +982,7 @@ const struct address_space_operations ext2_aops = {
const struct address_space_operations ext2_nobh_aops = {
	.dirty_folio		= block_dirty_folio,
	.invalidate_folio	= block_invalidate_folio,
	.readpage		= ext2_readpage,
	.read_folio		= ext2_read_folio,
	.readahead		= ext2_readahead,
	.writepage		= ext2_nobh_writepage,
	.write_begin		= ext2_nobh_write_begin,
+3 −3
Original line number Diff line number Diff line
@@ -205,9 +205,9 @@ static int fat_writepages(struct address_space *mapping,
	return mpage_writepages(mapping, wbc, fat_get_block);
}

static int fat_readpage(struct file *file, struct page *page)
static int fat_read_folio(struct file *file, struct folio *folio)
{
	return mpage_readpage(page, fat_get_block);
	return mpage_read_folio(folio, fat_get_block);
}

static void fat_readahead(struct readahead_control *rac)
@@ -344,7 +344,7 @@ int fat_block_truncate_page(struct inode *inode, loff_t from)
static const struct address_space_operations fat_aops = {
	.dirty_folio	= block_dirty_folio,
	.invalidate_folio = block_invalidate_folio,
	.readpage	= fat_readpage,
	.read_folio	= fat_read_folio,
	.readahead	= fat_readahead,
	.writepage	= fat_writepage,
	.writepages	= fat_writepages,
+7 −8
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ static int __gfs2_readpage(void *file, struct page *page)
		error = stuffed_readpage(ip, page);
		unlock_page(page);
	} else {
		error = mpage_readpage(page, gfs2_block_map);
		error = mpage_read_folio(folio, gfs2_block_map);
	}

	if (unlikely(gfs2_withdrawn(sdp)))
@@ -490,14 +490,13 @@ static int __gfs2_readpage(void *file, struct page *page)
}

/**
 * gfs2_readpage - read a page of a file
 * gfs2_read_folio - read a folio from a file
 * @file: The file to read
 * @page: The page of the file
 * @folio: The folio in the file
 */

static int gfs2_readpage(struct file *file, struct page *page)
static int gfs2_read_folio(struct file *file, struct folio *folio)
{
	return __gfs2_readpage(file, page);
	return __gfs2_readpage(file, &folio->page);
}

/**
@@ -773,7 +772,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
static const struct address_space_operations gfs2_aops = {
	.writepage = gfs2_writepage,
	.writepages = gfs2_writepages,
	.readpage = gfs2_readpage,
	.read_folio = gfs2_read_folio,
	.readahead = gfs2_readahead,
	.dirty_folio = filemap_dirty_folio,
	.releasepage = iomap_releasepage,
@@ -788,7 +787,7 @@ static const struct address_space_operations gfs2_aops = {
static const struct address_space_operations gfs2_jdata_aops = {
	.writepage = gfs2_jdata_writepage,
	.writepages = gfs2_jdata_writepages,
	.readpage = gfs2_readpage,
	.read_folio = gfs2_read_folio,
	.readahead = gfs2_readahead,
	.dirty_folio = jdata_dirty_folio,
	.bmap = gfs2_bmap,
+3 −3
Original line number Diff line number Diff line
@@ -158,9 +158,9 @@ static const struct iomap_ops hpfs_iomap_ops = {
	.iomap_begin		= hpfs_iomap_begin,
};

static int hpfs_readpage(struct file *file, struct page *page)
static int hpfs_read_folio(struct file *file, struct folio *folio)
{
	return mpage_readpage(page, hpfs_get_block);
	return mpage_read_folio(folio, hpfs_get_block);
}

static int hpfs_writepage(struct page *page, struct writeback_control *wbc)
@@ -247,7 +247,7 @@ static int hpfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
const struct address_space_operations hpfs_aops = {
	.dirty_folio	= block_dirty_folio,
	.invalidate_folio = block_invalidate_folio,
	.readpage = hpfs_readpage,
	.read_folio = hpfs_read_folio,
	.writepage = hpfs_writepage,
	.readahead = hpfs_readahead,
	.writepages = hpfs_writepages,
Loading