public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, amir73il@gmail.com,
	miklos@szeredi.hu, joannelkoong@gmail.com, bschubert@ddn.com
Subject: Re: [PATCH 01/11] fuse: convert readahead to use folios
Date: Tue, 27 Aug 2024 18:23:44 -0400	[thread overview]
Message-ID: <20240827222344.GB2597336@perftesting> (raw)
In-Reply-To: <Zs5JUcQlI13LG8i4@casper.infradead.org>

On Tue, Aug 27, 2024 at 10:46:57PM +0100, Matthew Wilcox wrote:
> On Tue, Aug 27, 2024 at 04:45:14PM -0400, Josef Bacik wrote:
> >  
> > +/*
> > + * Wait for page writeback in the range to be completed.  This will work for
> > + * folio_size() > PAGE_SIZE, even tho we don't currently allow that.
> > + */
> > +static void fuse_wait_on_folio_writeback(struct inode *inode,
> > +					 struct folio *folio)
> > +{
> > +	for (pgoff_t index = folio_index(folio);
> > +	     index < folio_next_index(folio); index++)
> > +		fuse_wait_on_page_writeback(inode, index);
> > +}
> 
> Would it be better to write this as:
> 
> 	struct fuse_inode *fi = get_fuse_inode(inode);
> 	pgoff_t last = folio_next_index(folio) - 1;
> 
> 	wait_event(fi->page_waitq, !fuse_range_is_writeback(inode,
> 				folio->index, last));
> 
> > @@ -1015,13 +1036,14 @@ static void fuse_readahead(struct readahead_control *rac)
> >  		if (!ia)
> >  			return;
> >  		ap = &ia->ap;
> > -		nr_pages = __readahead_batch(rac, ap->pages, nr_pages);
> > -		for (i = 0; i < nr_pages; i++) {
> > -			fuse_wait_on_page_writeback(inode,
> > -						    readahead_index(rac) + i);
> > -			ap->descs[i].length = PAGE_SIZE;
> > +
> > +		while (nr_folios < nr_pages &&
> > +		       (folio = readahead_folio(rac)) != NULL) {
> > +			fuse_wait_on_folio_writeback(inode, folio);
> 
> Oh.  Even easier, we should hoist the whole thing to here.  Before
> this loop,
> 
> 		pgoff_t first = readahead_index(rac);
> 		pgoff_t last = first + readahead_count(rac) - 1;
> 		wait_event(fi->page_waitq, !fuse_range_is_writeback(inode,
> 				first, last);
> 
> (I'm not quite sure how we might have pending writeback still when we're
> doing readahead, but fuse is a funny creature and if somebody explains
> why to me, I'll probably forget again)
> 

Ah good suggestion, I like this better.  I didn't read carefully enough and
thought the waitqueue was on the writeback struct.  I'll rework it in the
morning and re-send once the tests run again.

> > +			ap->pages[i] = &folio->page;
> > +			ap->descs[i].length = folio_size(folio);
> > +			ap->num_pages++;
> 
> I do want to turn __readahead_batch into working on folios, but that
> involves working on fuse & squashfs at the same time ... I see you
> got rid of the readahead_page_batch() in btrfs recently; that'll help.

Do you want me to tackle that since I'm messing around in this area anyway?  My
only hesitation is we're limited to the 32 folios or whatever the pagevec count
is nowadays, and we may want to cycle through more.  But I've just finished
eating dinner and haven't actually looked at anything yet.  Thanks,

Josef

  reply	other threads:[~2024-08-27 22:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 20:45 [PATCH 00/11] fuse: convert to using folios and iomap Josef Bacik
2024-08-27 20:45 ` [PATCH 01/11] fuse: convert readahead to use folios Josef Bacik
2024-08-27 21:46   ` Matthew Wilcox
2024-08-27 22:23     ` Josef Bacik [this message]
2024-08-27 20:45 ` [PATCH 02/11] fuse: convert fuse_send_write_pages " Josef Bacik
2024-08-27 21:53   ` Matthew Wilcox
2024-08-27 22:24     ` Josef Bacik
2024-08-27 20:45 ` [PATCH 03/11] fuse: convert fuse_fill_write_pages " Josef Bacik
2024-08-27 21:30   ` Joanne Koong
2024-08-27 22:25     ` Josef Bacik
2024-08-27 20:45 ` [PATCH 04/11] fuse: convert fuse_page_mkwrite " Josef Bacik
2024-08-27 20:45 ` [PATCH 05/11] fuse: use kiocb_modified in buffered write path Josef Bacik
2024-08-27 20:45 ` [PATCH 06/11] fuse: use iomap for writeback cache buffered writes Josef Bacik
2024-08-28  5:16   ` Christoph Hellwig
2024-08-27 20:45 ` [PATCH 07/11] fuse: convert fuse_do_readpage to use folios Josef Bacik
2024-08-27 20:45 ` [PATCH 08/11] fuse: convert fuse_writepage_need_send to take a folio Josef Bacik
2024-08-27 20:45 ` [PATCH 09/11] fuse: use the folio based vmstat helpers Josef Bacik
2024-08-27 22:05   ` Joanne Koong
2024-08-27 20:45 ` [PATCH 10/11] fuse: convert fuse_retrieve to use folios Josef Bacik
2024-08-27 22:10   ` Joanne Koong
2024-08-27 20:45 ` [PATCH 11/11] fuse: convert fuse_notify_store " Josef Bacik
2024-08-27 21:36 ` [PATCH 00/11] fuse: convert to using folios and iomap Bernd Schubert
2024-08-27 22:18   ` 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=20240827222344.GB2597336@perftesting \
    --to=josef@toxicpanda.com \
    --cc=amir73il@gmail.com \
    --cc=bschubert@ddn.com \
    --cc=joannelkoong@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox