Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

squashfs: convert squashfs_readpage_block() to take a folio

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>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
2a7aea59 8c1565fc

+10 -11
+1 -1
fs/squashfs/file.c
··· 472 472 if (res == 0) 473 473 res = squashfs_readpage_sparse(&folio->page, expected); 474 474 else 475 - res = squashfs_readpage_block(&folio->page, block, res, expected); 475 + res = squashfs_readpage_block(folio, block, res, expected); 476 476 } else 477 477 res = squashfs_readpage_fragment(folio, expected); 478 478
+3 -3
fs/squashfs/file_cache.c
··· 18 18 #include "squashfs.h" 19 19 20 20 /* Read separately compressed datablock and memcopy into page cache */ 21 - int squashfs_readpage_block(struct page *page, u64 block, int bsize, int expected) 21 + int squashfs_readpage_block(struct folio *folio, u64 block, int bsize, int expected) 22 22 { 23 - struct inode *i = page->mapping->host; 23 + struct inode *i = folio->mapping->host; 24 24 struct squashfs_cache_entry *buffer = squashfs_get_datablock(i->i_sb, 25 25 block, bsize); 26 26 int res = buffer->error; ··· 29 29 ERROR("Unable to read page, block %llx, size %x\n", block, 30 30 bsize); 31 31 else 32 - squashfs_copy_cache(page, buffer, expected, 0); 32 + squashfs_copy_cache(&folio->page, buffer, expected, 0); 33 33 34 34 squashfs_cache_put(buffer); 35 35 return res;
+5 -6
fs/squashfs/file_direct.c
··· 19 19 #include "page_actor.h" 20 20 21 21 /* Read separately compressed datablock directly into page cache */ 22 - int squashfs_readpage_block(struct page *target_page, u64 block, int bsize, 23 - int expected) 24 - 22 + int squashfs_readpage_block(struct folio *folio, u64 block, int bsize, 23 + int expected) 25 24 { 26 - struct folio *folio = page_folio(target_page); 27 - struct inode *inode = target_page->mapping->host; 25 + struct page *target_page = &folio->page; 26 + struct inode *inode = folio->mapping->host; 28 27 struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; 29 28 loff_t file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT; 30 29 int mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1; ··· 47 48 /* Try to grab all the pages covered by the Squashfs block */ 48 49 for (i = 0, index = start_index; index <= end_index; index++) { 49 50 page[i] = (index == folio->index) ? target_page : 50 - grab_cache_page_nowait(target_page->mapping, index); 51 + grab_cache_page_nowait(folio->mapping, index); 51 52 52 53 if (page[i] == NULL) 53 54 continue;
+1 -1
fs/squashfs/squashfs.h
··· 78 78 int); 79 79 80 80 /* file_xxx.c */ 81 - extern int squashfs_readpage_block(struct page *, u64, int, int); 81 + int squashfs_readpage_block(struct folio *, u64 block, int bsize, int expected); 82 82 83 83 /* id.c */ 84 84 extern int squashfs_get_id(struct super_block *, unsigned int, unsigned int *);