squashfs: convert squashfs_readpage_block() to take a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 20 Dec 2024 22:46:26 +0000 (22:46 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 25 Jan 2025 06:47:22 +0000 (22:47 -0800)
Remove a few accesses to page->mapping.

Link: https://lkml.kernel.org/r/20241220224634.723899-3-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/squashfs/file.c
fs/squashfs/file_cache.c
fs/squashfs/file_direct.c
fs/squashfs/squashfs.h

index 6bd16e12493b277035820126dc4fec9ede0f6d83..5b81e26b122623d2a4e8b8e11c836e23a6fedfca 100644 (file)
@@ -472,7 +472,7 @@ static int squashfs_read_folio(struct file *file, struct folio *folio)
                if (res == 0)
                        res = squashfs_readpage_sparse(&folio->page, expected);
                else
-                       res = squashfs_readpage_block(&folio->page, block, res, expected);
+                       res = squashfs_readpage_block(folio, block, res, expected);
        } else
                res = squashfs_readpage_fragment(folio, expected);
 
index 54c17b7c85fddae977d6d6ba21cd7d0ddee9d54a..0360d22a77d4ac2e1be03c2cfeb5bbfb99d48368 100644 (file)
@@ -18,9 +18,9 @@
 #include "squashfs.h"
 
 /* Read separately compressed datablock and memcopy into page cache */
-int squashfs_readpage_block(struct page *page, u64 block, int bsize, int expected)
+int squashfs_readpage_block(struct folio *folio, u64 block, int bsize, int expected)
 {
-       struct inode *i = page->mapping->host;
+       struct inode *i = folio->mapping->host;
        struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb,
                block, bsize);
        int res = buffer->error;
@@ -29,7 +29,7 @@ int squashfs_readpage_block(struct page *page, u64 block, int bsize, int expecte
                ERROR("Unable to read page, block %llx, size %x\n", block,
                        bsize);
        else
-               squashfs_copy_cache(page, buffer, expected, 0);
+               squashfs_copy_cache(&folio->page, buffer, expected, 0);
 
        squashfs_cache_put(buffer);
        return res;
index d19d4db74af83b4e4ccff0cf0242d8c738c73d3d..2c3e809d6891bff31ef0a95416d7c903fa7283df 100644 (file)
 #include "page_actor.h"
 
 /* Read separately compressed datablock directly into page cache */
-int squashfs_readpage_block(struct page *target_page, u64 block, int bsize,
-       int expected)
-
+int squashfs_readpage_block(struct folio *folio, u64 block, int bsize,
+               int expected)
 {
-       struct folio *folio = page_folio(target_page);
-       struct inode *inode = target_page->mapping->host;
+       struct page *target_page = &folio->page;
+       struct inode *inode = folio->mapping->host;
        struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
        loff_t file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT;
        int mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1;
@@ -48,7 +47,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize,
        /* Try to grab all the pages covered by the Squashfs block */
        for (i = 0, index = start_index; index <= end_index; index++) {
                page[i] = (index == folio->index) ? target_page :
-                       grab_cache_page_nowait(target_page->mapping, index);
+                       grab_cache_page_nowait(folio->mapping, index);
 
                if (page[i] == NULL)
                        continue;
index 2c45b9b938e9a131a2300da5598bfaa1de3a93df..9922a9460ce66c0a0220e7f583006851e7409b77 100644 (file)
@@ -78,7 +78,7 @@ void squashfs_copy_cache(struct page *, struct squashfs_cache_entry *, int,
                                int);
 
 /* file_xxx.c */
-extern int squashfs_readpage_block(struct page *, u64, int, int);
+int squashfs_readpage_block(struct folio *, u64 block, int bsize, int expected);
 
 /* id.c */
 extern int squashfs_get_id(struct super_block *, unsigned int, unsigned int *);