All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
	bernd.schubert@fastmail.fm, willy@infradead.org,
	kernel-team@meta.com
Subject: Re: [PATCH 01/13] fuse: support folios in struct fuse_args_pages and fuse_copy_pages()
Date: Fri, 18 Oct 2024 15:48:56 -0400	[thread overview]
Message-ID: <20241018194856.GA2473677@perftesting> (raw)
In-Reply-To: <20241002165253.3872513-2-joannelkoong@gmail.com>

On Wed, Oct 02, 2024 at 09:52:41AM -0700, Joanne Koong wrote:
> This adds support in struct fuse_args_pages and fuse_copy_pages() for
> using folios instead of pages for transferring data. Both folios and
> pages must be supported right now in struct fuse_args_pages and
> fuse_copy_pages() until all request types have been converted to use
> folios. Once all have been converted, then
> struct fuse_args_pages and fuse_copy_pages() will only support folios.
> 
> Right now in fuse, all folios are one page (large folios are not yet
> supported). As such, copying folio->page is sufficient for copying
> the entire folio in fuse_copy_pages().
> 
> No functional changes.
> 
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
> ---
>  fs/fuse/dev.c    | 36 ++++++++++++++++++++++++++++--------
>  fs/fuse/fuse_i.h | 22 +++++++++++++++++++---
>  2 files changed, 47 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index 7e4c5be45aec..cd9c5e0eefca 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -1028,17 +1028,37 @@ static int fuse_copy_pages(struct fuse_copy_state *cs, unsigned nbytes,
>  	struct fuse_req *req = cs->req;
>  	struct fuse_args_pages *ap = container_of(req->args, typeof(*ap), args);
>  
> +	if (ap->uses_folios) {
> +		for (i = 0; i < ap->num_folios && (nbytes || zeroing); i++) {
> +			int err;
> +			unsigned int offset = ap->folio_descs[i].offset;
> +			unsigned int count = min(nbytes, ap->folio_descs[i].length);
> +			struct page *orig, *pagep;
>  
> -	for (i = 0; i < ap->num_pages && (nbytes || zeroing); i++) {
> -		int err;
> -		unsigned int offset = ap->descs[i].offset;
> -		unsigned int count = min(nbytes, ap->descs[i].length);
> +			orig = pagep = &ap->folios[i]->page;
>  
> -		err = fuse_copy_page(cs, &ap->pages[i], offset, count, zeroing);
> -		if (err)
> -			return err;
> +			err = fuse_copy_page(cs, &pagep, offset, count, zeroing);
> +			if (err)
> +				return err;
> +
> +			nbytes -= count;
> +
> +			/* Check if the folio was replaced in the page cache */

This comment confused me, I think it would be better to say something like

/*
 * fuse_copy_page may have moved a page from a pipe instead of copying into our
 * given page, so update the folios if it was replaced.
 */

Or something like that.  Thanks,

Josef

  reply	other threads:[~2024-10-18 19:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 16:52 [PATCH 00/13] fuse: use folios instead of pages for requests Joanne Koong
2024-10-02 16:52 ` [PATCH 01/13] fuse: support folios in struct fuse_args_pages and fuse_copy_pages() Joanne Koong
2024-10-18 19:48   ` Josef Bacik [this message]
2024-10-02 16:52 ` [PATCH 02/13] fuse: add support in virtio for requests using folios Joanne Koong
2024-10-02 16:52 ` [PATCH 03/13] fuse: convert cuse to use folios Joanne Koong
2024-10-02 16:52 ` [PATCH 04/13] fuse: convert readlink " Joanne Koong
2024-10-02 16:52 ` [PATCH 05/13] fuse: convert readdir " Joanne Koong
2024-10-02 16:52 ` [PATCH 06/13] fuse: convert reads " Joanne Koong
2024-10-02 16:52 ` [PATCH 07/13] fuse: convert writes (non-writeback) " Joanne Koong
2024-10-02 16:52 ` [PATCH 08/13] fuse: convert ioctls " Joanne Koong
2024-10-02 16:52 ` [PATCH 09/13] fuse: convert retrieves " Joanne Koong
2024-10-02 16:52 ` [PATCH 10/13] fuse: convert writebacks " Joanne Koong
2024-10-02 16:52 ` [PATCH 11/13] mm/writeback: add folio_mark_dirty_lock() Joanne Koong
2024-10-18 20:01   ` Josef Bacik
2024-10-22 18:05     ` Joanne Koong
2024-10-02 16:52 ` [PATCH 12/13] fuse: convert direct io to use folios Joanne Koong
2024-10-18 20:02   ` Josef Bacik
2024-10-21 22:02     ` Joanne Koong
2024-10-02 16:52 ` [PATCH 13/13] fuse: remove pages for requests and exclusively " Joanne Koong
2024-10-18 20:07 ` [PATCH 00/13] fuse: use folios instead of pages for requests Josef Bacik

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=20241018194856.GA2473677@perftesting \
    --to=josef@toxicpanda.com \
    --cc=bernd.schubert@fastmail.fm \
    --cc=joannelkoong@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.