diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-10-12 20:34:19 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-11-10 18:15:42 +0100 |
commit | 3189de0ac310c3ca6e8576e46f2ff7539e1ffc33 (patch) | |
tree | 8abb0821540a7738369e27ccfb88e2f912ee4546 | |
parent | a663e6ab17a2eed537139ca7b23e0928e7923d86 (diff) | |
download | linux-stable-3189de0ac310c3ca6e8576e46f2ff7539e1ffc33.tar.gz linux-stable-3189de0ac310c3ca6e8576e46f2ff7539e1ffc33.tar.bz2 linux-stable-3189de0ac310c3ca6e8576e46f2ff7539e1ffc33.zip |
ext4,f2fs: fix readahead of verity data
commit 4fa0e3ff217f775cb58d2d6d51820ec519243fb9 upstream.
The recent change of page_cache_ra_unbounded() arguments was buggy in the
two callers, causing us to readahead the wrong pages. Move the definition
of ractl down to after the index is set correctly. This affected
performance on configurations that use fs-verity.
Link: https://lkml.kernel.org/r/20221012193419.1453558-1-willy@infradead.org
Fixes: 73bb49da50cd ("mm/readahead: make page_cache_ra_unbounded take a readahead_control")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reported-by: Jintao Yin <nicememory@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/ext4/verity.c | 3 | ||||
-rw-r--r-- | fs/f2fs/verity.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c index eacbd489e3bf..840639e7a7ca 100644 --- a/fs/ext4/verity.c +++ b/fs/ext4/verity.c @@ -364,13 +364,14 @@ static struct page *ext4_read_merkle_tree_page(struct inode *inode, pgoff_t index, unsigned long num_ra_pages) { - DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); struct page *page; index += ext4_verity_metadata_pos(inode) >> PAGE_SHIFT; page = find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED); if (!page || !PageUptodate(page)) { + DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); + if (page) put_page(page); else if (num_ra_pages > 1) diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c index fe5acdccaae1..a28968bb56e6 100644 --- a/fs/f2fs/verity.c +++ b/fs/f2fs/verity.c @@ -261,13 +261,14 @@ static struct page *f2fs_read_merkle_tree_page(struct inode *inode, pgoff_t index, unsigned long num_ra_pages) { - DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); struct page *page; index += f2fs_verity_metadata_pos(inode) >> PAGE_SHIFT; page = find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED); if (!page || !PageUptodate(page)) { + DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); + if (page) put_page(page); else if (num_ra_pages > 1) |