linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-fsdevel@vger.kernel.org, amir73il@gmail.com,
	miklos@szeredi.hu, joannelkoong@gmail.com, bschubert@ddn.com,
	willy@infradead.org
Subject: [PATCH v2 07/11] fuse: convert fuse_do_readpage to use folios
Date: Wed, 28 Aug 2024 17:13:57 -0400	[thread overview]
Message-ID: <c9f291bb96281f9329f1f703be295fffbfde1be5.1724879414.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1724879414.git.josef@toxicpanda.com>

Now that the buffered write path is using folios, convert
fuse_do_readpage() to take a folio instead of a page, update it to use
the appropriate folio helpers, and update the callers to pass in the
folio directly instead of a page.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/fuse/file.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index af91043b44d7..7b44efbe9653 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -859,12 +859,13 @@ static void fuse_short_read(struct inode *inode, u64 attr_ver, size_t num_read,
 	}
 }
 
-static int fuse_do_readpage(struct file *file, struct page *page)
+static int fuse_do_readpage(struct file *file, struct folio *folio)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = folio->mapping->host;
 	struct fuse_mount *fm = get_fuse_mount(inode);
-	loff_t pos = page_offset(page);
+	loff_t pos = folio_pos(folio);
 	struct fuse_page_desc desc = { .length = PAGE_SIZE };
+	struct page *page = &folio->page;
 	struct fuse_io_args ia = {
 		.ap.args.page_zeroing = true,
 		.ap.args.out_pages = true,
@@ -876,11 +877,10 @@ static int fuse_do_readpage(struct file *file, struct page *page)
 	u64 attr_ver;
 
 	/*
-	 * Page writeback can extend beyond the lifetime of the
-	 * page-cache page, so make sure we read a properly synced
-	 * page.
+	 * Folio writeback can extend beyond the lifetime of the
+	 * folio, so make sure we read a properly synced folio.
 	 */
-	fuse_wait_on_page_writeback(inode, page->index);
+	fuse_wait_on_folio_writeback(inode, folio);
 
 	attr_ver = fuse_get_attr_version(fm->fc);
 
@@ -898,25 +898,24 @@ static int fuse_do_readpage(struct file *file, struct page *page)
 	if (res < desc.length)
 		fuse_short_read(inode, attr_ver, res, &ia.ap);
 
-	SetPageUptodate(page);
+	folio_mark_uptodate(folio);
 
 	return 0;
 }
 
 static int fuse_read_folio(struct file *file, struct folio *folio)
 {
-	struct page *page = &folio->page;
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = folio->mapping->host;
 	int err;
 
 	err = -EIO;
 	if (fuse_is_bad(inode))
 		goto out;
 
-	err = fuse_do_readpage(file, page);
+	err = fuse_do_readpage(file, folio);
 	fuse_invalidate_atime(inode);
  out:
-	unlock_page(page);
+	folio_unlock(folio);
 	return err;
 }
 
@@ -1447,7 +1446,7 @@ static struct folio *fuse_iomap_get_folio(struct iomap_iter *iter,
 	if (fsize <= folio_pos(folio)) {
 		folio_zero_range(folio, 0, folio_size(folio));
 	} else {
-		int err = fuse_do_readpage(file, &folio->page);
+		int err = fuse_do_readpage(file, folio);
 		if (err) {
 			folio_unlock(folio);
 			folio_put(folio);
-- 
2.43.0


  parent reply	other threads:[~2024-08-28 21:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28 21:13 [PATCH v2 00/11] fuse: convert to using folios and iomap Josef Bacik
2024-08-28 21:13 ` [PATCH v2 01/11] fuse: convert readahead to use folios Josef Bacik
2024-08-28 21:13 ` [PATCH v2 02/11] fuse: convert fuse_send_write_pages " Josef Bacik
2024-08-28 21:13 ` [PATCH v2 03/11] fuse: convert fuse_fill_write_pages " Josef Bacik
2024-08-28 21:13 ` [PATCH v2 04/11] fuse: convert fuse_page_mkwrite " Josef Bacik
2024-08-28 21:13 ` [PATCH v2 05/11] fuse: use kiocb_modified in buffered write path Josef Bacik
2024-09-10 21:51   ` Bernd Schubert
2024-08-28 21:13 ` [PATCH v2 06/11] fuse: use iomap for writeback cache buffered writes Josef Bacik
2024-08-29  3:50   ` Dave Chinner
2024-08-29 14:23     ` Josef Bacik
2024-08-29 23:30   ` Bernd Schubert
2024-08-28 21:13 ` Josef Bacik [this message]
2024-08-28 21:13 ` [PATCH v2 08/11] fuse: convert fuse_writepage_need_send to take a folio Josef Bacik
2024-08-28 21:13 ` [PATCH v2 09/11] fuse: use the folio based vmstat helpers Josef Bacik
2024-08-28 21:14 ` [PATCH v2 10/11] fuse: convert fuse_retrieve to use folios Josef Bacik
2024-08-28 21:14 ` [PATCH v2 11/11] fuse: convert fuse_notify_store " 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=c9f291bb96281f9329f1f703be295fffbfde1be5.1724879414.git.josef@toxicpanda.com \
    --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;
as well as URLs for NNTP newsgroup(s).