summaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-06-01 15:11:01 -0400
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-06-29 08:51:05 -0400
commitd9ef44de5d731e1a1fa94ddb5e39ea1b308b1456 (patch)
tree80351a286a1e3d6a852ef44300e6eade024676a8 /mm/hugetlb.c
parent211d04445b96db5b3640bcf345ad59105068a549 (diff)
downloadlinux-d9ef44de5d731e1a1fa94ddb5e39ea1b308b1456.tar.bz2
hugetlb: Convert huge_add_to_page_cache() to use a folio
Remove the last caller of add_to_page_cache() Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a57e1be41401..33b2c27e7c61 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5414,19 +5414,25 @@ static bool hugetlbfs_pagecache_present(struct hstate *h,
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
pgoff_t idx)
{
+ struct folio *folio = page_folio(page);
struct inode *inode = mapping->host;
struct hstate *h = hstate_inode(inode);
- int err = add_to_page_cache(page, mapping, idx, GFP_KERNEL);
+ int err;
- if (err)
+ __folio_set_locked(folio);
+ err = __filemap_add_folio(mapping, folio, idx, GFP_KERNEL, NULL);
+
+ if (unlikely(err)) {
+ __folio_clear_locked(folio);
return err;
+ }
ClearHPageRestoreReserve(page);
/*
- * set page dirty so that it will not be removed from cache/file
+ * mark folio dirty so that it will not be removed from cache/file
* by non-hugetlbfs specific code paths.
*/
- set_page_dirty(page);
+ folio_mark_dirty(folio);
spin_lock(&inode->i_lock);
inode->i_blocks += blocks_per_huge_page(h);