From: Matthew Wilcox (Oracle) Date: Wed, 14 May 2025 17:13:12 +0000 (+0100) Subject: fs: Convert __page_get_link() to use a folio X-Git-Tag: v6.16-rc1~223^2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f152cc012f42e19d40088039c07eec3736b0705;p=thirdparty%2Flinux.git 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)" Link: https://lore.kernel.org/20250514171316.3002934-2-willy@infradead.org Signed-off-by: Christian Brauner --- diff --git a/fs/namei.c b/fs/namei.c index b051211f064c5..7b76611d1a8c5 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -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,