linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, amir73il@gmail.com,
	miklos@szeredi.hu, kernel-team@fb.com
Subject: Re: [PATCH v3 01/10] fuse: convert readahead to use folios
Date: Mon, 30 Sep 2024 09:33:57 -0400	[thread overview]
Message-ID: <20240930133357.GA652530@perftesting> (raw)
In-Reply-To: <CAJnrk1bELT0PwOQFzKYryEYQgpJiZ3fyUjERaWH4f+NgM1oirg@mail.gmail.com>

On Fri, Sep 27, 2024 at 03:22:25PM -0700, Joanne Koong wrote:
> On Fri, Sep 27, 2024 at 1:45 PM Josef Bacik <josef@toxicpanda.com> wrote:
> >
> > Currently we're using the __readahead_batch() helper which populates our
> > fuse_args_pages->pages array with pages.  Convert this to use the newer
> > folio based pattern which is to call readahead_folio() to get the next
> > folio in the read ahead batch.  I've updated the code to use things like
> > folio_size() and to take into account larger folio sizes, but this is
> > purely to make that eventual work easier to do, we currently will not
> > get large folios so this is more future proofing than actual support.
> >
> > Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> > ---
> >  fs/fuse/file.c | 43 ++++++++++++++++++++++++++++---------------
> >  1 file changed, 28 insertions(+), 15 deletions(-)
> >
> > diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> > index f33fbce86ae0..132528cde745 100644
> > --- a/fs/fuse/file.c
> > +++ b/fs/fuse/file.c
> > @@ -938,7 +938,6 @@ static void fuse_readpages_end(struct fuse_mount *fm, struct fuse_args *args,
> >                 struct folio *folio = page_folio(ap->pages[i]);
> >
> >                 folio_end_read(folio, !err);
> > -               folio_put(folio);
> >         }
> >         if (ia->ff)
> >                 fuse_file_put(ia->ff, false);
> > @@ -985,18 +984,36 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
> >  static void fuse_readahead(struct readahead_control *rac)
> >  {
> >         struct inode *inode = rac->mapping->host;
> > +       struct fuse_inode *fi = get_fuse_inode(inode);
> >         struct fuse_conn *fc = get_fuse_conn(inode);
> > -       unsigned int i, max_pages, nr_pages = 0;
> > +       unsigned int max_pages, nr_pages;
> > +       pgoff_t first = readahead_index(rac);
> > +       pgoff_t last = first + readahead_count(rac) - 1;
> >
> >         if (fuse_is_bad(inode))
> >                 return;
> >
> > +       wait_event(fi->page_waitq, !fuse_range_is_writeback(inode, first, last));
> 
> Should this line be moved to after we check the readahead count? eg
> 
> nr_pages = readahead_count(rac);
> if (!nr_pages)
>     return;
> wait_event(fi->page_waitq, !fuse_range_is_writeback(inode, first, last));
> 
> Otherwise I think in that case you mentioned where read_pages() calls
> into readahead_folio() after it's consumed the last folio, we end up
> calling this wait_event

The first bit of read_pages covers this for us

static void read_pages(struct readahead_control *rac)
{
        const struct address_space_operations *aops = rac->mapping->a_ops;
        struct folio *folio;
        struct blk_plug plug;

        if (!readahead_count(rac))
                return;

We don't get ->readahead called unless there's pages to read.  Thanks,

Josef

  reply	other threads:[~2024-09-30 13:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-27 20:44 [PATCH v3 00/10] fuse: folio conversions Josef Bacik
2024-09-27 20:44 ` [PATCH v3 01/10] fuse: convert readahead to use folios Josef Bacik
2024-09-27 22:22   ` Joanne Koong
2024-09-30 13:33     ` Josef Bacik [this message]
2024-09-27 20:44 ` [PATCH v3 02/10] fuse: convert fuse_send_write_pages " Josef Bacik
2024-09-27 22:24   ` Joanne Koong
2024-09-27 20:44 ` [PATCH v3 03/10] fuse: convert fuse_fill_write_pages " Josef Bacik
2024-09-27 22:36   ` Joanne Koong
2024-09-27 20:44 ` [PATCH v3 04/10] fuse: convert fuse_page_mkwrite " Josef Bacik
2024-09-27 22:42   ` Joanne Koong
2024-09-27 20:44 ` [PATCH v3 05/10] fuse: use kiocb_modified in buffered write path Josef Bacik
2024-09-27 20:44 ` [PATCH v3 06/10] fuse: convert fuse_do_readpage to use folios Josef Bacik
2024-09-27 22:51   ` Joanne Koong
2024-09-30 13:39     ` Josef Bacik
2024-09-27 20:44 ` [PATCH v3 07/10] fuse: convert fuse_writepage_need_send to take a folio Josef Bacik
2024-09-27 22:55   ` Joanne Koong
2024-09-27 20:44 ` [PATCH v3 08/10] fuse: use the folio based vmstat helpers Josef Bacik
2024-09-27 20:45 ` [PATCH v3 09/10] fuse: convert fuse_retrieve to use folios Josef Bacik
2024-09-27 22:59   ` Joanne Koong
2024-09-27 20:45 ` [PATCH v3 10/10] fuse: convert fuse_notify_store " Josef Bacik
2024-09-27 23:08   ` Joanne Koong

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=20240930133357.GA652530@perftesting \
    --to=josef@toxicpanda.com \
    --cc=amir73il@gmail.com \
    --cc=joannelkoong@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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;
as well as URLs for NNTP newsgroup(s).