fs: Convert __page_get_link() to use a folio

Retrieve a folio from the page cache instead of a page and operate
on it.  Removes two hidden calls to compound_head().

Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Link: https://lore.kernel.org/20250514171316.3002934-2-willy@infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2025-05-14 18:13:12 +01:00 committed by Christian Brauner
parent 4fae90d04a
commit 5f152cc012
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -5371,25 +5371,25 @@ EXPORT_SYMBOL(vfs_get_link);
static char *__page_get_link(struct dentry *dentry, struct inode *inode,
struct delayed_call *callback)
{
struct page *page;
struct folio *folio;
struct address_space *mapping = inode->i_mapping;
if (!dentry) {
page = find_get_page(mapping, 0);
if (!page)
folio = filemap_get_folio(mapping, 0);
if (IS_ERR(folio))
return ERR_PTR(-ECHILD);
if (!PageUptodate(page)) {
put_page(page);
if (!folio_test_uptodate(folio)) {
folio_put(folio);
return ERR_PTR(-ECHILD);
}
} else {
page = read_mapping_page(mapping, 0, NULL);
if (IS_ERR(page))
return (char*)page;
folio = read_mapping_folio(mapping, 0, NULL);
if (IS_ERR(folio))
return ERR_CAST(folio);
}
set_delayed_call(callback, page_put_link, page);
set_delayed_call(callback, page_put_link, &folio->page);
BUG_ON(mapping_gfp_mask(mapping) & __GFP_HIGHMEM);
return page_address(page);
return folio_address(folio);
}
const char *page_get_link_raw(struct dentry *dentry, struct inode *inode,