summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2023-09-21 22:07:40 +0200
committerJan Kara <jack@suse.cz>2023-10-25 20:19:00 +0200
commit52df49ee835d79d8e50f38d89d75bf0891854511 (patch)
treefe7a39d00536b5f65c9dcacc8bc1f93ca58696da /fs/ext2
parentext2: Convert ext2_check_page to ext2_check_folio (diff)
downloadlinux-52df49ee835d79d8e50f38d89d75bf0891854511.tar.xz
linux-52df49ee835d79d8e50f38d89d75bf0891854511.zip
ext2: Add ext2_get_folio()
Convert ext2_get_page() into ext2_get_folio() and keep the original function around as a temporary wrapper. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230921200746.3303942-3-willy@infradead.org>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/dir.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 03867381eec2..5c1b7bded535 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -180,34 +180,46 @@ fail:
}
/*
- * Calls to ext2_get_page()/ext2_put_page() must be nested according to the
- * rules documented in kmap_local_page()/kunmap_local().
+ * Calls to ext2_get_folio()/folio_release_kmap() must be nested according
+ * to the rules documented in kmap_local_folio()/kunmap_local().
*
- * NOTE: ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page()
- * and should be treated as a call to ext2_get_page() for nesting purposes.
+ * NOTE: ext2_find_entry() and ext2_dotdot() act as a call
+ * to folio_release_kmap() and should be treated as a call to
+ * folio_release_kmap() for nesting purposes.
*/
-static void *ext2_get_page(struct inode *dir, unsigned long n,
- int quiet, struct page **page)
+static void *ext2_get_folio(struct inode *dir, unsigned long n,
+ int quiet, struct folio **foliop)
{
struct address_space *mapping = dir->i_mapping;
struct folio *folio = read_mapping_folio(mapping, n, NULL);
- void *page_addr;
+ void *kaddr;
if (IS_ERR(folio))
return ERR_CAST(folio);
- page_addr = kmap_local_folio(folio, 0);
+ kaddr = kmap_local_folio(folio, 0);
if (unlikely(!folio_test_checked(folio))) {
- if (!ext2_check_folio(folio, quiet, page_addr))
+ if (!ext2_check_folio(folio, quiet, kaddr))
goto fail;
}
- *page = &folio->page;
- return page_addr;
+ *foliop = folio;
+ return kaddr;
fail:
- ext2_put_page(&folio->page, page_addr);
+ folio_release_kmap(folio, kaddr);
return ERR_PTR(-EIO);
}
+static void *ext2_get_page(struct inode *dir, unsigned long n,
+ int quiet, struct page **pagep)
+{
+ struct folio *folio;
+ void *kaddr = ext2_get_folio(dir, n, quiet, &folio);
+
+ if (!IS_ERR(kaddr))
+ *pagep = &folio->page;
+ return kaddr;
+}
+
/*
* NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
*