[PATCH 08/16] squashfs: remove the page based page actor
From: Tal Zussman
Date: Tue Nov 03 2026 - 09:31:52 EST
All users have moved to the folio actor. Remove the page one.
This removes the last struct page usage in the page actor, file.c, and
file_direct.c.
Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
---
fs/squashfs/page_actor.c | 81 ------------------------------------------------
fs/squashfs/page_actor.h | 15 ---------
2 files changed, 96 deletions(-)
diff --git a/fs/squashfs/page_actor.c b/fs/squashfs/page_actor.c
index 8471f69e5cbe..8cf6c956d802 100644
--- a/fs/squashfs/page_actor.c
+++ b/fs/squashfs/page_actor.c
@@ -60,87 +60,6 @@ struct squashfs_page_actor *squashfs_page_actor_init(void **buffer,
}
/* Implementation of page_actor for decompressing directly into page cache. */
-static loff_t page_next_index(struct squashfs_page_actor *actor)
-{
- return page_folio(actor->page[actor->next_page])->index;
-}
-
-static void *handle_next_page(struct squashfs_page_actor *actor)
-{
- int max_pages = (actor->length + PAGE_SIZE - 1) >> PAGE_SHIFT;
-
- if (actor->returned_pages == max_pages)
- return NULL;
-
- if ((actor->next_page == actor->pages) ||
- (actor->next_index != page_next_index(actor))) {
- actor->next_index++;
- actor->returned_pages++;
- actor->last_page = NULL;
- return actor->alloc_buffer ? actor->tmp_buffer : ERR_PTR(-ENOMEM);
- }
-
- actor->next_index++;
- actor->returned_pages++;
- actor->last_page = actor->page[actor->next_page];
- return actor->pageaddr = kmap_local_page(actor->page[actor->next_page++]);
-}
-
-static void *direct_first_page(struct squashfs_page_actor *actor)
-{
- return handle_next_page(actor);
-}
-
-static void *direct_next_page(struct squashfs_page_actor *actor)
-{
- if (actor->pageaddr) {
- kunmap_local(actor->pageaddr);
- actor->pageaddr = NULL;
- }
-
- return handle_next_page(actor);
-}
-
-static void direct_finish_page(struct squashfs_page_actor *actor)
-{
- if (actor->pageaddr)
- kunmap_local(actor->pageaddr);
-}
-
-struct squashfs_page_actor *squashfs_page_actor_init_special(struct squashfs_sb_info *msblk,
- struct page **page, int pages, int length, loff_t start_index)
-{
- struct squashfs_page_actor *actor = kmalloc_obj(*actor);
-
- if (actor == NULL)
- return NULL;
-
- if (msblk->decompressor->alloc_buffer) {
- actor->tmp_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
-
- if (actor->tmp_buffer == NULL) {
- kfree(actor);
- return NULL;
- }
- } else
- actor->tmp_buffer = NULL;
-
- actor->length = length ? : pages * PAGE_SIZE;
- actor->page = page;
- actor->pages = pages;
- actor->next_page = 0;
- actor->returned_pages = 0;
- actor->next_index = start_index >> PAGE_SHIFT;
- actor->pageaddr = NULL;
- actor->last_page = NULL;
- actor->alloc_buffer = msblk->decompressor->alloc_buffer;
- actor->squashfs_first_page = direct_first_page;
- actor->squashfs_next_page = direct_next_page;
- actor->squashfs_finish_page = direct_finish_page;
- return actor;
-}
-
-/* Implementation of page_actor for decompressing directly into folios. */
static void *handle_next_folio(struct squashfs_page_actor *actor)
{
int max_pages = (actor->length + PAGE_SIZE - 1) >> PAGE_SHIFT;
diff --git a/fs/squashfs/page_actor.h b/fs/squashfs/page_actor.h
index bab0a19be266..3a98bf691ba3 100644
--- a/fs/squashfs/page_actor.h
+++ b/fs/squashfs/page_actor.h
@@ -9,7 +9,6 @@
struct squashfs_page_actor {
union {
void **buffer;
- struct page **page;
struct folio **folio;
};
void *pageaddr;
@@ -17,7 +16,6 @@ struct squashfs_page_actor {
void *(*squashfs_first_page)(struct squashfs_page_actor *);
void *(*squashfs_next_page)(struct squashfs_page_actor *);
void (*squashfs_finish_page)(struct squashfs_page_actor *);
- struct page *last_page;
struct folio *last_folio;
int pages;
int length;
@@ -29,23 +27,10 @@ struct squashfs_page_actor {
extern struct squashfs_page_actor *squashfs_page_actor_init(void **buffer,
int pages, int length);
-extern struct squashfs_page_actor *squashfs_page_actor_init_special(
- struct squashfs_sb_info *msblk,
- struct page **page, int pages, int length,
- loff_t start_index);
struct squashfs_page_actor *squashfs_page_actor_init_folios(
struct squashfs_sb_info *msblk,
struct folio **folio, int nr_folios, int length,
loff_t start);
-static inline struct page *squashfs_page_actor_free(struct squashfs_page_actor *actor)
-{
- struct page *last_page = actor->next_page == actor->pages ? actor->last_page : ERR_PTR(-EIO);
-
- kfree(actor->tmp_buffer);
- kfree(actor);
-
- return last_page;
-}
static inline struct folio *squashfs_page_actor_free_folios(struct squashfs_page_actor *actor)
{
struct folio *last_folio = actor->next_page == actor->pages ?
--
2.39.5