linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] squashfs: Use a folio throughout squashfs_read_folio()
@ 2024-12-16 16:26 Matthew Wilcox (Oracle)
  2024-12-16 16:26 ` [PATCH 2/5] squashfs: Pass a folio to squashfs_readpage_fragment() Matthew Wilcox (Oracle)
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-12-16 16:26 UTC (permalink / raw)
  To: Phillip Lougher
  Cc: Matthew Wilcox (Oracle), linux-kernel, linux-fsdevel, linux-mm

Use modern folio APIs where they exist and convert back to struct
page for the internal functions.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/squashfs/file.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
index 21aaa96856c1..bc6598c3a48f 100644
--- a/fs/squashfs/file.c
+++ b/fs/squashfs/file.c
@@ -445,21 +445,19 @@ static int squashfs_readpage_sparse(struct page *page, int expected)
 
 static int squashfs_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;
 	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
-	int index = page->index >> (msblk->block_log - PAGE_SHIFT);
+	int index = folio->index >> (msblk->block_log - PAGE_SHIFT);
 	int file_end = i_size_read(inode) >> msblk->block_log;
 	int expected = index == file_end ?
 			(i_size_read(inode) & (msblk->block_size - 1)) :
 			 msblk->block_size;
 	int res = 0;
-	void *pageaddr;
 
 	TRACE("Entered squashfs_readpage, page index %lx, start block %llx\n",
-				page->index, squashfs_i(inode)->start);
+				folio->index, squashfs_i(inode)->start);
 
-	if (page->index >= ((i_size_read(inode) + PAGE_SIZE - 1) >>
+	if (folio->index >= ((i_size_read(inode) + PAGE_SIZE - 1) >>
 					PAGE_SHIFT))
 		goto out;
 
@@ -472,23 +470,18 @@ static int squashfs_read_folio(struct file *file, struct folio *folio)
 			goto out;
 
 		if (res == 0)
-			res = squashfs_readpage_sparse(page, expected);
+			res = squashfs_readpage_sparse(&folio->page, expected);
 		else
-			res = squashfs_readpage_block(page, block, res, expected);
+			res = squashfs_readpage_block(&folio->page, block, res, expected);
 	} else
-		res = squashfs_readpage_fragment(page, expected);
+		res = squashfs_readpage_fragment(&folio->page, expected);
 
 	if (!res)
 		return 0;
 
 out:
-	pageaddr = kmap_atomic(page);
-	memset(pageaddr, 0, PAGE_SIZE);
-	kunmap_atomic(pageaddr);
-	flush_dcache_page(page);
-	if (res == 0)
-		SetPageUptodate(page);
-	unlock_page(page);
+	folio_zero_segment(folio, 0, folio_size(folio));
+	folio_end_read(folio, res == 0);
 
 	return res;
 }
-- 
2.45.2



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-01-14 21:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-16 16:26 [PATCH 1/5] squashfs: Use a folio throughout squashfs_read_folio() Matthew Wilcox (Oracle)
2024-12-16 16:26 ` [PATCH 2/5] squashfs: Pass a folio to squashfs_readpage_fragment() Matthew Wilcox (Oracle)
2025-01-14 21:08   ` Phillip Lougher
2024-12-16 16:26 ` [PATCH 3/5] squashfs: Convert squashfs_readpage_block() to take a folio Matthew Wilcox (Oracle)
2025-01-14 21:08   ` Phillip Lougher
2024-12-16 16:26 ` [PATCH 4/5] squashfs; Convert squashfs_copy_cache() " Matthew Wilcox (Oracle)
2025-01-14 21:08   ` Phillip Lougher
2024-12-16 16:26 ` [PATCH 5/5] squashfs: Convert squashfs_fill_page() " Matthew Wilcox (Oracle)
2024-12-20 18:19   ` Phillip Lougher
2024-12-20 18:19   ` Phillip Lougher
2024-12-20 18:24     ` Matthew Wilcox
2024-12-20 18:42       ` Phillip Lougher
2024-12-20 22:19         ` Andrew Morton
2025-01-14 21:08   ` Phillip Lougher
2025-01-14 21:07 ` [PATCH 1/5] squashfs: Use a folio throughout squashfs_read_folio() Phillip Lougher
2025-01-14 21:10   ` Phillip Lougher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox