summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-05-18 01:06:23 +0300
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-08-02 19:34:03 +0300
commit37ce0b319b287666e2133ca740b73089355fe498 (patch)
tree920654057c64633c88938fb12a09a3271a2ae898 /fs/ext2
parent240159077d007527324a1e245ecd78b10a2b0d36 (diff)
downloadlinux-37ce0b319b287666e2133ca740b73089355fe498.tar.xz
ext2: Use a folio in ext2_get_page()
Remove a call to read_mapping_page(). Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/dir.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 8326b63f0b70..8f597753ac12 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -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);
}