Skip to contentSkip to conversation

f2fs: convert pagecache_read() to use folios

PATCH In review Svyatoslav Nikolenko 2 participants 3 messages Oct 2 – Oct 5 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: convert pagecache_read() to use folios

Replace page-based APIs with folio equivalents in pagecache_read() to migrate fs/f2fs/verity.c away from struct page.

---
 fs/f2fs/verity.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
fs/f2fs/verity.c +12 -9
index ee838f880c4a..69bdd22ba96e 100644
@@ -45,18 +45,21 @@ static int pagecache_read(struct inode *inode, void *buf, size_t count,
 			  loff_t pos)
 {
 	while (count) {
-		size_t n = min_t(size_t, count,
-				 PAGE_SIZE - offset_in_page(pos));
-		struct page *page;
+		struct folio *folio;
+		size_t n;
+
+		folio = read_mapping_folio(inode->i_mapping, pos >> PAGE_SHIFT,
+					NULL);
+
+		if (IS_ERR(folio))
+			return PTR_ERR(folio);
 
-		page = read_mapping_page(inode->i_mapping, pos >> PAGE_SHIFT,
-					 NULL);
-		if (IS_ERR(page))
-			return PTR_ERR(page);
+		n = min_t(size_t, count,
+				 folio_size(folio) - offset_in_folio(folio, pos));
 
-		memcpy_from_page(buf, page, offset_in_page(pos), n);
+		memcpy_from_folio(buf, folio, offset_in_folio(folio, pos), n);
 
-		put_page(page);
+		folio_put(folio);
 
 		buf += n;
 		pos += n;
Signature · 1 line
2.47.3
#2 lore raw
Quoted 11 lines · On Fri, Oct 02, 2026 at 04:29:34PM -0700, Eric Biggers via Linux-f2fs-devel…
Quoted 4 lines · Svyatoslav Nikolenko

Replace page-based APIs with folio equivalents in pagecache_read() to migrate fs/f2fs/verity.c away from struct page.

This will conflict with
https://lore.kernel.org/fsverity/[email protected]

I'm checking if that one will go into 7.4. If so, this one won't be needed.

I applied
https://lore.kernel.org/fsverity/[email protected]
for 7.4, so there's no need for this one.

- Eric