Skip to content

Commit e9ebecf

Browse files
Matthew Wilcoxtytso
authored andcommitted
ext4: Use a folio in ext4_read_merkle_tree_page
This is an implementation of fsverity_operations read_merkle_tree_page, so it must still return the precise page asked for, but we can use the folio API to reduce the number of conversions between folios & pages. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent b23fb76 commit e9ebecf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/ext4/verity.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,21 +361,21 @@ static struct page *ext4_read_merkle_tree_page(struct inode *inode,
361361
pgoff_t index,
362362
unsigned long num_ra_pages)
363363
{
364-
struct page *page;
364+
struct folio *folio;
365365

366366
index += ext4_verity_metadata_pos(inode) >> PAGE_SHIFT;
367367

368-
page = find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED);
369-
if (!page || !PageUptodate(page)) {
368+
folio = __filemap_get_folio(inode->i_mapping, index, FGP_ACCESSED, 0);
369+
if (!folio || !folio_test_uptodate(folio)) {
370370
DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index);
371371

372-
if (page)
373-
put_page(page);
372+
if (folio)
373+
folio_put(folio);
374374
else if (num_ra_pages > 1)
375375
page_cache_ra_unbounded(&ractl, num_ra_pages, 0);
376-
page = read_mapping_page(inode->i_mapping, index, NULL);
376+
folio = read_mapping_folio(inode->i_mapping, index, NULL);
377377
}
378-
return page;
378+
return folio_file_page(folio, index);
379379
}
380380

381381
static int ext4_write_merkle_tree_block(struct inode *inode, const void *buf,

0 commit comments

Comments
 (0)