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

Squashfs: Update page_actor to not use page->index

This commit removes an unnecessary use of page->index,
and moves the other use over to folio->index.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Link: https://lore.kernel.org/r/20240818235847.170468-2-phillip@squashfs.org.uk
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Phillip Lougher and committed by
Christian Brauner
2258e22f 8400291e

+13 -6
+1 -1
fs/squashfs/file.c
··· 589 589 goto skip_pages; 590 590 591 591 actor = squashfs_page_actor_init_special(msblk, pages, nr_pages, 592 - expected); 592 + expected, start); 593 593 if (!actor) 594 594 goto skip_pages; 595 595
+2 -1
fs/squashfs/file_direct.c
··· 67 67 * Create a "page actor" which will kmap and kunmap the 68 68 * page cache pages appropriately within the decompressor 69 69 */ 70 - actor = squashfs_page_actor_init_special(msblk, page, pages, expected); 70 + actor = squashfs_page_actor_init_special(msblk, page, pages, expected, 71 + start_index << PAGE_SHIFT); 71 72 if (actor == NULL) 72 73 goto out; 73 74
+8 -3
fs/squashfs/page_actor.c
··· 60 60 } 61 61 62 62 /* Implementation of page_actor for decompressing directly into page cache. */ 63 + static loff_t page_next_index(struct squashfs_page_actor *actor) 64 + { 65 + return page_folio(actor->page[actor->next_page])->index; 66 + } 67 + 63 68 static void *handle_next_page(struct squashfs_page_actor *actor) 64 69 { 65 70 int max_pages = (actor->length + PAGE_SIZE - 1) >> PAGE_SHIFT; ··· 73 68 return NULL; 74 69 75 70 if ((actor->next_page == actor->pages) || 76 - (actor->next_index != actor->page[actor->next_page]->index)) { 71 + (actor->next_index != page_next_index(actor))) { 77 72 actor->next_index++; 78 73 actor->returned_pages++; 79 74 actor->last_page = NULL; ··· 108 103 } 109 104 110 105 struct squashfs_page_actor *squashfs_page_actor_init_special(struct squashfs_sb_info *msblk, 111 - struct page **page, int pages, int length) 106 + struct page **page, int pages, int length, loff_t start_index) 112 107 { 113 108 struct squashfs_page_actor *actor = kmalloc(sizeof(*actor), GFP_KERNEL); 114 109 ··· 130 125 actor->pages = pages; 131 126 actor->next_page = 0; 132 127 actor->returned_pages = 0; 133 - actor->next_index = page[0]->index & ~((1 << (msblk->block_log - PAGE_SHIFT)) - 1); 128 + actor->next_index = start_index >> PAGE_SHIFT; 134 129 actor->pageaddr = NULL; 135 130 actor->last_page = NULL; 136 131 actor->alloc_buffer = msblk->decompressor->alloc_buffer;
+2 -1
fs/squashfs/page_actor.h
··· 29 29 int pages, int length); 30 30 extern struct squashfs_page_actor *squashfs_page_actor_init_special( 31 31 struct squashfs_sb_info *msblk, 32 - struct page **page, int pages, int length); 32 + struct page **page, int pages, int length, 33 + loff_t start_index); 33 34 static inline struct page *squashfs_page_actor_free(struct squashfs_page_actor *actor) 34 35 { 35 36 struct page *last_page = actor->last_page;