diff options
author | Kefeng Wang <wangkefeng.wang@huawei.com> | 2024-03-21 21:16:38 +0800 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-04-05 15:53:46 +0200 |
commit | 75a07b557a11a713c85f5fa8f9ed99b8c9b6f5d8 (patch) | |
tree | 9815f9a9927e6b835352c17eb790863971ad14ca /fs/aio.c | |
parent | 85a6a1aff08ec9f5b929d345d066e2830e8818e5 (diff) |
fs: aio: use a folio in aio_setup_ring()
Use a folio throughout aio_setup_ring() to remove calls to compound_head(),
also use folio_end_read() to simultaneously mark the folio uptodate and
unlock it.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Link: https://lore.kernel.org/r/20240321131640.948634-2-wangkefeng.wang@huawei.com
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/aio.c')
-rw-r--r-- | fs/aio.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -527,17 +527,19 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events) } for (i = 0; i < nr_pages; i++) { - struct page *page; - page = find_or_create_page(file->f_mapping, - i, GFP_USER | __GFP_ZERO); - if (!page) + struct folio *folio; + + folio = __filemap_get_folio(file->f_mapping, i, + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, + GFP_USER | __GFP_ZERO); + if (IS_ERR(folio)) break; - pr_debug("pid(%d) page[%d]->count=%d\n", - current->pid, i, page_count(page)); - SetPageUptodate(page); - unlock_page(page); - ctx->ring_pages[i] = page; + pr_debug("pid(%d) [%d] folio->count=%d\n", current->pid, i, + folio_ref_count(folio)); + folio_end_read(folio, true); + + ctx->ring_pages[i] = &folio->page; } ctx->nr_pages = i; |