[PATCH 00/16] squashfs: convert the read paths to folios

From: Tal Zussman

Date: Tue Nov 03 2026 - 08:58:03 EST


Convert squashfs's read paths to folios.

Patches 1-4 fix bugs found along the way. Patch 1 fixes a hang reading
past 8 TiB of a file through squashfs_copy_cache(). Patch 2 stops
readahead from reading an extra block when the window is already block
aligned. Patches 3 and 4 fix a locked page leak and a kmap leak on error
paths.

Patches 5-9 add a folio based page actor, convert the two users to it,
and remove the page based one. This removes some of the last callers
of grab_cache_page_nowait() and readahead_batch_length(), and a few
hidden compound_head() calls per folio.

Patches 10-13 make the actor, the tail zeroing, the readpage_block
lookups, and the cache copy step by folio size instead of PAGE_SIZE.
squashfs only uses order-0 folios, so nothing changes yet. This is a
step towards enabling large folios.

Patches 14 and 15 are small cleanups on the way.

Patch 16 fills the compressed data bio with folios. This removes one of
the last callers of find_get_page().

Tested in a KVM guest with KASAN, lockdep and kmemleak, with both
CONFIG_SQUASHFS_FILE_CACHE and CONFIG_SQUASHFS_FILE_DIRECT, by mounting
images built with every compressor at 4K, 128K and 1M block sizes and
checking the data through readahead, read_folio, mmap and concurrent
readers, with no failures or warnings. Each pre-existing bug was
reproduced on the base kernel and fixed with the series.

---
Tal Zussman (16):
squashfs: don't truncate page cache indices in squashfs_copy_cache()
squashfs: don't read an extra block when expanding readahead
squashfs: release the grabbed pages if allocating the page actor fails
squashfs: unmap the current page when a readahead fragment copy fails
squashfs: add a folio based page actor
squashfs: convert squashfs_readpage_block() to folios
squashfs: convert squashfs_readahead() to folios
squashfs: remove the page based page actor
squashfs: give the folio page actor helpers their old names back
squashfs: walk folios by offset in the page actor
squashfs: zero the tail of the last folio up to folio_size()
squashfs: step squashfs_readpage_block() lookups by folio
squashfs: copy cache entries by folio size
squashfs: use folio_pos() and squashfs_block_bytes() in squashfs_read_folio()
squashfs: use folio_end_read() for cached folios in squashfs_bio_read_cached()
squashfs: use folios to fill the bio in squashfs_bio_read()

fs/squashfs/block.c | 52 +++++------
fs/squashfs/file.c | 203 ++++++++++++++++++++++---------------------
fs/squashfs/file_direct.c | 104 +++++++++++-----------
fs/squashfs/page_actor.c | 67 ++++++++------
fs/squashfs/page_actor.h | 34 ++++++--
fs/squashfs/squashfs_fs_sb.h | 24 +++++
6 files changed, 271 insertions(+), 213 deletions(-)
---
base-commit: 4fab3abf085638e7fd2ebabf0aab8aa299486207
change-id: 20261012-squashfs-folio-51095c19f276

Best regards,
--
Tal Zussman <tz2294@xxxxxxxxxxxx>