]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ext4,f2fs: fix readahead of verity data
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 12 Oct 2022 19:34:19 +0000 (20:34 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 13 Oct 2022 01:51:48 +0000 (18:51 -0700)
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>
fs/ext4/verity.c
fs/f2fs/verity.c

index b051d19b5c8a04cf313b440782c396f482140011..94442c690ca7d0550723d32289c2908b2dbdc892 100644 (file)
@@ -365,13 +365,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)
index 7b8f2b41c29b12fb79056c325a2ca5a933930f57..c0733f867074684a1b0c62743447a70bd2c03dd4 100644 (file)
@@ -262,13 +262,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)