Skip to content

squashfs: convert the read paths to folios

Tal Zussman lkml stable 1 version In review

Get series with b4
b4 am [email protected] change-id 20261012-squashfs-folio-51095c19f276

Versions newest first

  1. v1 Latest16 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16squashfs: don't truncate page cache indices in squashfs_copy_cache()fs/squashfs/file.c+4 -30 replies
2/16squashfs: don't read an extra block when expanding readaheadfs/squashfs/file.c+1 -10 replies
3/16squashfs: release the grabbed pages if allocating the page actor failsfs/squashfs/file_direct.c+1 -20 replies
4/16squashfs: unmap the current page when a readahead fragment copy failsfs/squashfs/file.c+1 -00 replies
5/16squashfs: add a folio based page actorfs/squashfs/page_actor.c fs/squashfs/page_actor.h+98 -00 replies
6/16squashfs: convert squashfs_readpage_block() to foliosfs/squashfs/file_direct.c fs/squashfs/squashfs_fs_sb.h+72 -470 replies
7/16squashfs: convert squashfs_readahead() to foliosfs/squashfs/file.c+66 -710 replies
8/16squashfs: remove the page based page actorfs/squashfs/page_actor.c fs/squashfs/page_actor.h+0 -960 replies
9/16squashfs: give the folio page actor helpers their old names backfs/squashfs/file.c fs/squashfs/file_direct.c fs/squashfs/page_actor.c +1 more+11 -110 replies
10/16squashfs: walk folios by offset in the page actorfs/squashfs/page_actor.c fs/squashfs/page_actor.h+21 -60 replies
11/16squashfs: zero the tail of the last folio up to folio_size()fs/squashfs/file.c fs/squashfs/file_direct.c fs/squashfs/page_actor.h+26 -130 replies
12/16squashfs: step squashfs_readpage_block() lookups by foliofs/squashfs/file_direct.c+6 -20 replies
13/16squashfs: copy cache entries by folio sizefs/squashfs/file.c+36 -241 reply
14/16squashfs: use folio_pos() and squashfs_block_bytes() in squashfs_read_folio()fs/squashfs/file.c+4 -70 replies
15/16squashfs: use folio_end_read() for cached folios in squashfs_bio_read_cached()fs/squashfs/block.c+6 -130 replies
16/16squashfs: use folios to fill the bio in squashfs_bio_read()fs/squashfs/block.c+17 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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,

Signature · 1 line
Tal Zussman <[email protected]>