Skip to content

Commit 75a07b5

Browse files
Kefeng Wangbrauner
authored andcommitted
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>
1 parent 85a6a1a commit 75a07b5

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

fs/aio.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,17 +527,19 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events)
527527
}
528528

529529
for (i = 0; i < nr_pages; i++) {
530-
struct page *page;
531-
page = find_or_create_page(file->f_mapping,
532-
i, GFP_USER | __GFP_ZERO);
533-
if (!page)
530+
struct folio *folio;
531+
532+
folio = __filemap_get_folio(file->f_mapping, i,
533+
FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
534+
GFP_USER | __GFP_ZERO);
535+
if (IS_ERR(folio))
534536
break;
535-
pr_debug("pid(%d) page[%d]->count=%d\n",
536-
current->pid, i, page_count(page));
537-
SetPageUptodate(page);
538-
unlock_page(page);
539537

540-
ctx->ring_pages[i] = page;
538+
pr_debug("pid(%d) [%d] folio->count=%d\n", current->pid, i,
539+
folio_ref_count(folio));
540+
folio_end_read(folio, true);
541+
542+
ctx->ring_pages[i] = &folio->page;
541543
}
542544
ctx->nr_pages = i;
543545

0 commit comments

Comments
 (0)