Skip to content

Commit 5f152cc

Browse files
Matthew Wilcox (Oracle)brauner
authored andcommitted
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)" <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 4fae90d commit 5f152cc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

fs/namei.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5371,25 +5371,25 @@ EXPORT_SYMBOL(vfs_get_link);
53715371
static char *__page_get_link(struct dentry *dentry, struct inode *inode,
53725372
struct delayed_call *callback)
53735373
{
5374-
struct page *page;
5374+
struct folio *folio;
53755375
struct address_space *mapping = inode->i_mapping;
53765376

53775377
if (!dentry) {
5378-
page = find_get_page(mapping, 0);
5379-
if (!page)
5378+
folio = filemap_get_folio(mapping, 0);
5379+
if (IS_ERR(folio))
53805380
return ERR_PTR(-ECHILD);
5381-
if (!PageUptodate(page)) {
5382-
put_page(page);
5381+
if (!folio_test_uptodate(folio)) {
5382+
folio_put(folio);
53835383
return ERR_PTR(-ECHILD);
53845384
}
53855385
} else {
5386-
page = read_mapping_page(mapping, 0, NULL);
5387-
if (IS_ERR(page))
5388-
return (char*)page;
5386+
folio = read_mapping_folio(mapping, 0, NULL);
5387+
if (IS_ERR(folio))
5388+
return ERR_CAST(folio);
53895389
}
5390-
set_delayed_call(callback, page_put_link, page);
5390+
set_delayed_call(callback, page_put_link, &folio->page);
53915391
BUG_ON(mapping_gfp_mask(mapping) & __GFP_HIGHMEM);
5392-
return page_address(page);
5392+
return folio_address(folio);
53935393
}
53945394

53955395
const char *page_get_link_raw(struct dentry *dentry, struct inode *inode,

0 commit comments

Comments
 (0)