diff options
| author | Christoph Hellwig <hch@lst.de> | 2026-01-28 16:26:18 +0100 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2026-01-29 09:39:41 -0800 |
| commit | 821ddd25fbe88ea60e9c35cfb76c2ddeb1ffae26 (patch) | |
| tree | 7ef1f85cb965a4c9fc9ee62d29dabdd87175c510 /fs/ext4 | |
| parent | ac09a30900d81ac10606f650e3c720cfafa37be0 (diff) | |
fsverity: start consolidating pagecache code
ext4 and f2fs are largely using the same code to read a page full
of Merkle tree blocks from the page cache, and the upcoming xfs
fsverity support would add another copy.
Move the ext4 code to fs/verity/ and use it in f2fs as well. For f2fs
this removes the previous f2fs-specific error injection, but otherwise
the behavior remains unchanged.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Link: https://lore.kernel.org/r/20260128152630.627409-7-hch@lst.de
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'fs/ext4')
| -rw-r--r-- | fs/ext4/verity.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c index 2ce4cf8a1e31..a071860ad36a 100644 --- a/fs/ext4/verity.c +++ b/fs/ext4/verity.c @@ -361,23 +361,8 @@ static struct page *ext4_read_merkle_tree_page(struct inode *inode, pgoff_t index, unsigned long num_ra_pages) { - struct folio *folio; - index += ext4_verity_metadata_pos(inode) >> PAGE_SHIFT; - - folio = __filemap_get_folio(inode->i_mapping, index, FGP_ACCESSED, 0); - if (IS_ERR(folio) || !folio_test_uptodate(folio)) { - DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); - - if (!IS_ERR(folio)) - folio_put(folio); - else if (num_ra_pages > 1) - page_cache_ra_unbounded(&ractl, num_ra_pages, 0); - folio = read_mapping_folio(inode->i_mapping, index, NULL); - if (IS_ERR(folio)) - return ERR_CAST(folio); - } - return folio_file_page(folio, index); + return generic_read_merkle_tree_page(inode, index, num_ra_pages); } static int ext4_write_merkle_tree_block(struct file *file, const void *buf, |
