From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Benjamin LaHaise <bcrl@kvack.org>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
<linux-kernel@vger.kernel.org>,
Matthew Wilcox <willy@infradead.org>
Cc: <linux-aio@kvack.org>, <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/3] fs: aio: use a folio in aio_setup_ring()
Date: Thu, 21 Mar 2024 17:07:58 +0800 [thread overview]
Message-ID: <45a2ab40-bc03-417e-9b9a-bb140e5f3444@huawei.com> (raw)
In-Reply-To: <20240321082733.614329-2-wangkefeng.wang@huawei.com>
On 2024/3/21 16:27, Kefeng Wang wrote:
> Use a folio throughout aio_setup_ring() to remove calls to compound_head().
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> fs/aio.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 9cdaa2faa536..d7f6c8705016 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -527,17 +527,20 @@ 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 (!folio)
Oh, this should be if (IS_ERR(folio)), will update.
> 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_mark_uptodate(folio);
> + folio_unlock(folio);
> +
> + ctx->ring_pages[i] = &folio->page;
> }
> ctx->nr_pages = i;
>
next prev parent reply other threads:[~2024-03-21 9:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 8:27 [PATCH 0/3] fs: aio: more folio conversion Kefeng Wang
2024-03-21 8:27 ` [PATCH 1/3] fs: aio: use a folio in aio_setup_ring() Kefeng Wang
2024-03-21 9:07 ` Kefeng Wang [this message]
2024-03-21 12:23 ` Matthew Wilcox
2024-03-21 8:27 ` [PATCH 2/3] fs: aio: use a folio in aio_free_ring() Kefeng Wang
2024-03-21 8:27 ` [PATCH 3/3] fs: aio: convert to ring_folios and internal_folios Kefeng Wang
2024-03-21 12:26 ` [PATCH 0/3] fs: aio: more folio conversion Matthew Wilcox
2024-03-21 13:31 ` Kefeng Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45a2ab40-bc03-417e-9b9a-bb140e5f3444@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=bcrl@kvack.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®