ext2: Use a folio in ext2_get_page()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 17 May 2022 22:06:23 +0000 (18:06 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 2 Aug 2022 16:34:03 +0000 (12:34 -0400)
Remove a call to read_mapping_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
fs/ext2/dir.c

index 8326b63..8f59775 100644 (file)
@@ -200,18 +200,19 @@ static struct page * ext2_get_page(struct inode *dir, unsigned long n,
                                   int quiet, void **page_addr)
 {
        struct address_space *mapping = dir->i_mapping;
-       struct page *page = read_mapping_page(mapping, n, NULL);
-       if (!IS_ERR(page)) {
-               *page_addr = kmap_local_page(page);
-               if (unlikely(!PageChecked(page))) {
-                       if (!ext2_check_page(page, quiet, *page_addr))
-                               goto fail;
-               }
+       struct folio *folio = read_mapping_folio(mapping, n, NULL);
+
+       if (IS_ERR(folio))
+               return &folio->page;
+       *page_addr = kmap_local_folio(folio, n & (folio_nr_pages(folio) - 1));
+       if (unlikely(!folio_test_checked(folio))) {
+               if (!ext2_check_page(&folio->page, quiet, *page_addr))
+                       goto fail;
        }
-       return page;
+       return &folio->page;
 
 fail:
-       ext2_put_page(page, *page_addr);
+       ext2_put_page(&folio->page, *page_addr);
        return ERR_PTR(-EIO);
 }