All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Richard Weinberger <richard@nod.at>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-mtd@lists.infradead.org,
	Zhihao Cheng <chengzhihao1@huawei.com>
Subject: [PATCH v2 14/15] ubifs: Use a folio in ubifs_do_bulk_read()
Date: Wed, 24 Jan 2024 17:52:57 +0000	[thread overview]
Message-ID: <20240124175302.1750912-15-willy@infradead.org> (raw)
In-Reply-To: <20240124175302.1750912-1-willy@infradead.org>

When looking in the page cache, retrieve a folio instead of a page.
This would need some work to make it safe for large folios.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
 fs/ubifs/file.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index f481fca7f53d..11bf9f8cca6c 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -775,19 +775,19 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
 
 	for (page_idx = 1; page_idx < page_cnt; page_idx++) {
 		pgoff_t page_offset = offset + page_idx;
-		struct page *page;
+		struct folio *folio;
 
 		if (page_offset > end_index)
 			break;
-		page = pagecache_get_page(mapping, page_offset,
+		folio = __filemap_get_folio(mapping, page_offset,
 				 FGP_LOCK|FGP_ACCESSED|FGP_CREAT|FGP_NOWAIT,
 				 ra_gfp_mask);
-		if (!page)
+		if (IS_ERR(folio))
 			break;
-		if (!PageUptodate(page))
-			err = populate_page(c, page, bu, &n);
-		unlock_page(page);
-		put_page(page);
+		if (!folio_test_uptodate(folio))
+			err = populate_page(c, &folio->page, bu, &n);
+		folio_unlock(folio);
+		folio_put(folio);
 		if (err)
 			break;
 	}
-- 
2.43.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2024-01-24 17:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 17:52 [PATCH v2 00/15] ubifs folio conversion Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 01/15] ubifs: Set page uptodate in the correct place Matthew Wilcox (Oracle)
2024-01-24 17:52   ` Matthew Wilcox (Oracle)
2024-01-25  1:40   ` Zhihao Cheng
2024-01-25  1:40     ` Zhihao Cheng
2024-01-24 17:52 ` [PATCH v2 02/15] ubifs: Convert from writepage to writepages Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 03/15] ubifs: Convert ubifs_writepage to use a folio Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 04/15] ubifs: Use a folio in do_truncation() Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 05/15] ubifs: Convert do_writepage() to take a folio Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 06/15] ubifs: Convert ubifs_vm_page_mkwrite() to use " Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 07/15] ubifs: Convert write_begin_slow() " Matthew Wilcox (Oracle)
2024-01-25  1:46   ` Zhihao Cheng
2024-01-24 17:52 ` [PATCH v2 08/15] ubifs: Convert ubifs_write_begin() " Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 09/15] ubifs: Convert ubifs_write_end() " Matthew Wilcox (Oracle)
2024-01-25  1:50   ` Zhihao Cheng
2024-01-24 17:52 ` [PATCH v2 10/15] ubifs: Convert do_readpage() to take " Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 11/15] ubifs: Convert allocate_budget() to work on " Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 12/15] ubifs: Convert cancel_budget() to take " Matthew Wilcox (Oracle)
2024-01-24 17:52 ` [PATCH v2 13/15] ubifs: Pass a folio into ubifs_bulk_read() and ubifs_do_bulk_read() Matthew Wilcox (Oracle)
2024-01-24 17:52 ` Matthew Wilcox (Oracle) [this message]
2024-01-24 17:52 ` [PATCH v2 15/15] ubifs: Convert populate_page() to take a folio Matthew Wilcox (Oracle)

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=20240124175302.1750912-15-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=chengzhihao1@huawei.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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.