1
0

nfs: Use a folio in nfs_get_link()

Mirror the changes to __page_get_link() by retrieving a folio from
the page cache instead of a page.  Removes two hidden calls to
compound_head().

Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Link: https://lore.kernel.org/20250514171316.3002934-3-willy@infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle)
2025-05-14 18:13:13 +01:00
committed by Christian Brauner
parent 5f152cc012
commit cc8e87f312

View File

@@ -40,31 +40,31 @@ static const char *nfs_get_link(struct dentry *dentry,
struct inode *inode,
struct delayed_call *done)
{
struct page *page;
struct folio *folio;
void *err;
if (!dentry) {
err = ERR_PTR(nfs_revalidate_mapping_rcu(inode));
if (err)
return err;
page = find_get_page(inode->i_mapping, 0);
if (!page)
folio = filemap_get_folio(inode->i_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 {
err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping));
if (err)
return err;
page = read_cache_page(&inode->i_data, 0, nfs_symlink_filler,
folio = read_cache_folio(&inode->i_data, 0, nfs_symlink_filler,
NULL);
if (IS_ERR(page))
return ERR_CAST(page);
if (IS_ERR(folio))
return ERR_CAST(folio);
}
set_delayed_call(done, page_put_link, page);
return page_address(page);
set_delayed_call(done, page_put_link, &folio->page);
return folio_address(folio);
}
/*