Skip to content

Commit 7f73fcd

Browse files
plougherbrauner
authored andcommitted
Squashfs: Update squashfs_readpage_block() to not use page->index
This commit replaces references to page->index to folio->index or their equivalent. Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk> Link: https://lore.kernel.org/r/20240818235847.170468-4-phillip@squashfs.org.uk Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 6f09ffb commit 7f73fcd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/squashfs/file_direct.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize,
2323
int expected)
2424

2525
{
26+
struct folio *folio = page_folio(target_page);
2627
struct inode *inode = target_page->mapping->host;
2728
struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
28-
2929
loff_t file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT;
3030
int mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1;
31-
loff_t start_index = target_page->index & ~mask;
31+
loff_t start_index = folio->index & ~mask;
3232
loff_t end_index = start_index | mask;
3333
int i, n, pages, bytes, res = -ENOMEM;
34-
struct page **page;
34+
struct page **page, *last_page;
3535
struct squashfs_page_actor *actor;
3636
void *pageaddr;
3737

@@ -46,7 +46,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize,
4646

4747
/* Try to grab all the pages covered by the Squashfs block */
4848
for (i = 0, n = start_index; n <= end_index; n++) {
49-
page[i] = (n == target_page->index) ? target_page :
49+
page[i] = (n == folio->index) ? target_page :
5050
grab_cache_page_nowait(target_page->mapping, n);
5151

5252
if (page[i] == NULL)
@@ -75,7 +75,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize,
7575
/* Decompress directly into the page cache buffers */
7676
res = squashfs_read_data(inode->i_sb, block, bsize, NULL, actor);
7777

78-
squashfs_page_actor_free(actor);
78+
last_page = squashfs_page_actor_free(actor);
7979

8080
if (res < 0)
8181
goto mark_errored;
@@ -87,8 +87,8 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize,
8787

8888
/* Last page (if present) may have trailing bytes not filled */
8989
bytes = res % PAGE_SIZE;
90-
if (page[pages - 1]->index == end_index && bytes) {
91-
pageaddr = kmap_local_page(page[pages - 1]);
90+
if (end_index == file_end && last_page && bytes) {
91+
pageaddr = kmap_local_page(last_page);
9292
memset(pageaddr + bytes, 0, PAGE_SIZE - bytes);
9393
kunmap_local(pageaddr);
9494
}

0 commit comments

Comments
 (0)