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

Configure Feed

Select the types of activity you want to include in your feed.

squashfs: don't allocate read_page cache if SQUASHFS_FILE_DIRECT configured

If Squashfs has been configured to directly read datablocks into the page
cache (SQUASHFS_FILE_DIRECT), then the read_page cache is unnecessary.

This improvement is due to the following two commits, which added the
ability to read datablocks into the page cache when pages were missing,
enabling the fallback which used an intermediate buffer to be removed.

commit f268eedddf359 ("squashfs: extend "page actor" to handle missing pages")
commit 1bb1a07afad97 ("squashfs: don't use intermediate buffer if pages missing")

This reduces the amount of memory used when mounting a filesystem by
block_size * maximum number of threads.

Link: https://lkml.kernel.org/r/20241229233752.54481-3-phillip@squashfs.org.uk
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Phillip Lougher and committed by
Andrew Morton
f5cc0873 49ff2924

+7 -1
+6
fs/squashfs/squashfs.h
··· 14 14 15 15 #define WARNING(s, args...) pr_warn("SQUASHFS: "s, ## args) 16 16 17 + #ifdef CONFIG_SQUASHFS_FILE_CACHE 18 + #define SQUASHFS_READ_PAGES msblk->max_thread_num 19 + #else 20 + #define SQUASHFS_READ_PAGES 0 21 + #endif 22 + 17 23 /* block.c */ 18 24 extern int squashfs_read_data(struct super_block *, u64, int, u64 *, 19 25 struct squashfs_page_actor *);
+1 -1
fs/squashfs/super.c
··· 323 323 324 324 /* Allocate read_page block */ 325 325 msblk->read_page = squashfs_cache_init("data", 326 - msblk->max_thread_num, msblk->block_size); 326 + SQUASHFS_READ_PAGES, msblk->block_size); 327 327 if (IS_ERR(msblk->read_page)) { 328 328 errorf(fc, "Failed to allocate read_page block"); 329 329 err = PTR_ERR(msblk->read_page);