1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 222635ec9SAlexey Dobriyanconfig SQUASHFS 322635ec9SAlexey Dobriyan tristate "SquashFS 4.0 - Squashed file system support" 422635ec9SAlexey Dobriyan depends on BLOCK 522635ec9SAlexey Dobriyan help 622635ec9SAlexey Dobriyan Saying Y here includes support for SquashFS 4.0 (a Compressed 722635ec9SAlexey Dobriyan Read-Only File System). Squashfs is a highly compressed read-only 8d7f4b23cSPhillip Lougher filesystem for Linux. It uses zlib, lz4, lzo, xz or zstd compression 9d7f4b23cSPhillip Lougher to compress both files, inodes and directories. Inodes in the system 10681ffe2eSPhillip Lougher are very small and all blocks are packed to minimise data overhead. 11681ffe2eSPhillip Lougher Block sizes greater than 4K are supported up to a maximum of 1 Mbytes 12681ffe2eSPhillip Lougher (default block size 128K). SquashFS 4.0 supports 64 bit filesystems 13681ffe2eSPhillip Lougher and files (larger than 4GB), full uid/gid information, hard links and 1422635ec9SAlexey Dobriyan timestamps. 1522635ec9SAlexey Dobriyan 1622635ec9SAlexey Dobriyan Squashfs is intended for general read-only filesystem use, for 1722635ec9SAlexey Dobriyan archival use (i.e. in cases where a .tar.gz file may be used), and in 1822635ec9SAlexey Dobriyan embedded systems where low overhead is needed. Further information 19d7f4b23cSPhillip Lougher and tools are available from github.com/plougher/squashfs-tools. 2022635ec9SAlexey Dobriyan 2122635ec9SAlexey Dobriyan If you want to compile this as a module ( = code which can be 2222635ec9SAlexey Dobriyan inserted in and removed from the running kernel whenever you want), 23395cf969SPaul Bolle say M here. The module will be called squashfs. Note that the root 24395cf969SPaul Bolle file system (the one containing the directory /) cannot be compiled 25395cf969SPaul Bolle as a module. 2622635ec9SAlexey Dobriyan 2722635ec9SAlexey Dobriyan If unsure, say N. 2822635ec9SAlexey Dobriyan 29d208383dSPhillip Lougherchoice 300d455c12SPhillip Lougher prompt "File decompression options" 310d455c12SPhillip Lougher depends on SQUASHFS 320d455c12SPhillip Lougher help 330d455c12SPhillip Lougher Squashfs now supports two options for decompressing file 340d455c12SPhillip Lougher data. Traditionally Squashfs has decompressed into an 350d455c12SPhillip Lougher intermediate buffer and then memcopied it into the page cache. 360d455c12SPhillip Lougher Squashfs now supports the ability to decompress directly into 370d455c12SPhillip Lougher the page cache. 380d455c12SPhillip Lougher 390d455c12SPhillip Lougher If unsure, select "Decompress file data into an intermediate buffer" 400d455c12SPhillip Lougher 410d455c12SPhillip Lougherconfig SQUASHFS_FILE_CACHE 420d455c12SPhillip Lougher bool "Decompress file data into an intermediate buffer" 430d455c12SPhillip Lougher help 440d455c12SPhillip Lougher Decompress file data into an intermediate buffer and then 450d455c12SPhillip Lougher memcopy it into the page cache. 460d455c12SPhillip Lougher 470d455c12SPhillip Lougherconfig SQUASHFS_FILE_DIRECT 480d455c12SPhillip Lougher bool "Decompress files directly into the page cache" 490d455c12SPhillip Lougher help 500d455c12SPhillip Lougher Directly decompress file data into the page cache. 510d455c12SPhillip Lougher Doing so can significantly improve performance because 520d455c12SPhillip Lougher it eliminates a memcpy and it also removes the lock contention 530d455c12SPhillip Lougher on the single buffer. 540d455c12SPhillip Lougher 550d455c12SPhillip Lougherendchoice 560d455c12SPhillip Lougher 5780f78409SXiaoming Niconfig SQUASHFS_DECOMP_SINGLE 58d208383dSPhillip Lougher depends on SQUASHFS 5980f78409SXiaoming Ni def_bool n 6080f78409SXiaoming Ni 6180f78409SXiaoming Niconfig SQUASHFS_DECOMP_MULTI 6280f78409SXiaoming Ni depends on SQUASHFS 6380f78409SXiaoming Ni def_bool n 6480f78409SXiaoming Ni 6580f78409SXiaoming Niconfig SQUASHFS_DECOMP_MULTI_PERCPU 6680f78409SXiaoming Ni depends on SQUASHFS 6780f78409SXiaoming Ni def_bool n 6880f78409SXiaoming Ni 6980f78409SXiaoming Niconfig SQUASHFS_CHOICE_DECOMP_BY_MOUNT 7080f78409SXiaoming Ni bool "Select the parallel decompression mode during mount" 7180f78409SXiaoming Ni depends on SQUASHFS 7280f78409SXiaoming Ni default n 7380f78409SXiaoming Ni select SQUASHFS_DECOMP_SINGLE 7480f78409SXiaoming Ni select SQUASHFS_DECOMP_MULTI 7580f78409SXiaoming Ni select SQUASHFS_DECOMP_MULTI_PERCPU 76fb40fe04SXiaoming Ni select SQUASHFS_MOUNT_DECOMP_THREADS 7780f78409SXiaoming Ni help 7880f78409SXiaoming Ni Compile all parallel decompression modes and specify the 7980f78409SXiaoming Ni decompression mode by setting "threads=" during mount. 8080f78409SXiaoming Ni default Decompressor parallelisation is SQUASHFS_DECOMP_SINGLE 8180f78409SXiaoming Ni 8280f78409SXiaoming Nichoice 8380f78409SXiaoming Ni prompt "Select decompression parallel mode at compile time" 8480f78409SXiaoming Ni depends on SQUASHFS 8580f78409SXiaoming Ni depends on !SQUASHFS_CHOICE_DECOMP_BY_MOUNT 86d208383dSPhillip Lougher help 87d208383dSPhillip Lougher Squashfs now supports three parallelisation options for 88d208383dSPhillip Lougher decompression. Each one exhibits various trade-offs between 89d208383dSPhillip Lougher decompression performance and CPU and memory usage. 90d208383dSPhillip Lougher 91d208383dSPhillip Lougher If in doubt, select "Single threaded compression" 92d208383dSPhillip Lougher 9380f78409SXiaoming Niconfig SQUASHFS_COMPILE_DECOMP_SINGLE 94d208383dSPhillip Lougher bool "Single threaded compression" 9580f78409SXiaoming Ni select SQUASHFS_DECOMP_SINGLE 96d208383dSPhillip Lougher help 97d208383dSPhillip Lougher Traditionally Squashfs has used single-threaded decompression. 98d208383dSPhillip Lougher Only one block (data or metadata) can be decompressed at any 99d208383dSPhillip Lougher one time. This limits CPU and memory usage to a minimum. 100d208383dSPhillip Lougher 10180f78409SXiaoming Niconfig SQUASHFS_COMPILE_DECOMP_MULTI 102d208383dSPhillip Lougher bool "Use multiple decompressors for parallel I/O" 10380f78409SXiaoming Ni select SQUASHFS_DECOMP_MULTI 104d208383dSPhillip Lougher help 105d208383dSPhillip Lougher By default Squashfs uses a single decompressor but it gives 106d208383dSPhillip Lougher poor performance on parallel I/O workloads when using multiple CPU 107d208383dSPhillip Lougher machines due to waiting on decompressor availability. 108d208383dSPhillip Lougher 109d208383dSPhillip Lougher If you have a parallel I/O workload and your system has enough memory, 110d208383dSPhillip Lougher using this option may improve overall I/O performance. 111d208383dSPhillip Lougher 112d208383dSPhillip Lougher This decompressor implementation uses up to two parallel 113d208383dSPhillip Lougher decompressors per core. It dynamically allocates decompressors 114d208383dSPhillip Lougher on a demand basis. 115d208383dSPhillip Lougher 11680f78409SXiaoming Niconfig SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU 117d208383dSPhillip Lougher bool "Use percpu multiple decompressors for parallel I/O" 11880f78409SXiaoming Ni select SQUASHFS_DECOMP_MULTI_PERCPU 119d208383dSPhillip Lougher help 120d208383dSPhillip Lougher By default Squashfs uses a single decompressor but it gives 121d208383dSPhillip Lougher poor performance on parallel I/O workloads when using multiple CPU 122d208383dSPhillip Lougher machines due to waiting on decompressor availability. 123d208383dSPhillip Lougher 124d208383dSPhillip Lougher This decompressor implementation uses a maximum of one 125d208383dSPhillip Lougher decompressor per core. It uses percpu variables to ensure 126d208383dSPhillip Lougher decompression is load-balanced across the cores. 127d208383dSPhillip Lougherendchoice 128d208383dSPhillip Lougher 129fb40fe04SXiaoming Niconfig SQUASHFS_MOUNT_DECOMP_THREADS 130fb40fe04SXiaoming Ni bool "Add the mount parameter 'threads=' for squashfs" 131fb40fe04SXiaoming Ni depends on SQUASHFS 132fb40fe04SXiaoming Ni depends on SQUASHFS_DECOMP_MULTI 133fb40fe04SXiaoming Ni default n 134fb40fe04SXiaoming Ni help 135fb40fe04SXiaoming Ni Use threads= to set the decompression parallel mode and the number of threads. 136fb40fe04SXiaoming Ni If SQUASHFS_CHOICE_DECOMP_BY_MOUNT=y 137fb40fe04SXiaoming Ni threads=<single|multi|percpu|1|2|3|...> 138fb40fe04SXiaoming Ni else 139fb40fe04SXiaoming Ni threads=<2|3|...> 140fb40fe04SXiaoming Ni The upper limit is num_online_cpus() * 2. 141fb40fe04SXiaoming Ni 142637d5c9aSPhillip Lougherconfig SQUASHFS_XATTR 14301e5b4e4SPhillip Lougher bool "Squashfs XATTR support" 14401e5b4e4SPhillip Lougher depends on SQUASHFS 14501e5b4e4SPhillip Lougher help 14601e5b4e4SPhillip Lougher Saying Y here includes support for extended attributes (xattrs). 14701e5b4e4SPhillip Lougher Xattrs are name:value pairs associated with inodes by 14801e5b4e4SPhillip Lougher the kernel or by users (see the attr(5) manual page). 14901e5b4e4SPhillip Lougher 15001e5b4e4SPhillip Lougher If unsure, say N. 15101e5b4e4SPhillip Lougher 152*2e227ff5SChanho Minconfig SQUASHFS_COMP_CACHE_FULL 153*2e227ff5SChanho Min bool "Enable full caching of compressed blocks" 154*2e227ff5SChanho Min depends on SQUASHFS 155*2e227ff5SChanho Min default n 156*2e227ff5SChanho Min help 157*2e227ff5SChanho Min This option enables caching of all compressed blocks, Without caching, 158*2e227ff5SChanho Min repeated reads of the same files trigger excessive disk I/O, significantly 159*2e227ff5SChanho Min reducinng performance in workloads like fio-based benchmarks. 160*2e227ff5SChanho Min 161*2e227ff5SChanho Min For example, fio tests (iodepth=1, numjobs=1, ioengine=psync) show: 162*2e227ff5SChanho Min With caching: IOPS=2223, BW=278MiB/s (291MB/s) 163*2e227ff5SChanho Min Without caching: IOPS=815, BW=102MiB/s (107MB/s) 164*2e227ff5SChanho Min 165*2e227ff5SChanho Min Enabling this option restores performance to pre-regression levels by 166*2e227ff5SChanho Min caching all compressed blocks in the page cache, reducing disk I/O for 167*2e227ff5SChanho Min repeated reads. However, this increases memory usage, which may be a 168*2e227ff5SChanho Min concern in memory-constrained environments. 169*2e227ff5SChanho Min 170*2e227ff5SChanho Min Enable this option if your workload involves frequent repeated reads and 171*2e227ff5SChanho Min memory usage is not a limiting factor. If unsure, say N. 172*2e227ff5SChanho Min 173cc6d3497SPhillip Lougherconfig SQUASHFS_ZLIB 174cc6d3497SPhillip Lougher bool "Include support for ZLIB compressed file systems" 175cc6d3497SPhillip Lougher depends on SQUASHFS 176cc6d3497SPhillip Lougher select ZLIB_INFLATE 177cc6d3497SPhillip Lougher default y 178cc6d3497SPhillip Lougher help 179cc6d3497SPhillip Lougher ZLIB compression is the standard compression used by Squashfs 180cc6d3497SPhillip Lougher file systems. It offers a good trade-off between compression 181cc6d3497SPhillip Lougher achieved and the amount of CPU time and memory necessary to 182cc6d3497SPhillip Lougher compress and decompress. 183cc6d3497SPhillip Lougher 184cc6d3497SPhillip Lougher If unsure, say Y. 185cc6d3497SPhillip Lougher 18662421645SPhillip Lougherconfig SQUASHFS_LZ4 18762421645SPhillip Lougher bool "Include support for LZ4 compressed file systems" 18862421645SPhillip Lougher depends on SQUASHFS 18962421645SPhillip Lougher select LZ4_DECOMPRESS 19062421645SPhillip Lougher help 19162421645SPhillip Lougher Saying Y here includes support for reading Squashfs file systems 19262421645SPhillip Lougher compressed with LZ4 compression. LZ4 compression is mainly 19362421645SPhillip Lougher aimed at embedded systems with slower CPUs where the overheads 19462421645SPhillip Lougher of zlib are too high. 19562421645SPhillip Lougher 19662421645SPhillip Lougher LZ4 is not the standard compression used in Squashfs and so most 19762421645SPhillip Lougher file systems will be readable without selecting this option. 19862421645SPhillip Lougher 19962421645SPhillip Lougher If unsure, say N. 20062421645SPhillip Lougher 20179cb8cedSChan Jeongconfig SQUASHFS_LZO 20279cb8cedSChan Jeong bool "Include support for LZO compressed file systems" 20379cb8cedSChan Jeong depends on SQUASHFS 20479cb8cedSChan Jeong select LZO_DECOMPRESS 2054b676d2dSPhillip Lougher help 2064b676d2dSPhillip Lougher Saying Y here includes support for reading Squashfs file systems 20770f23fd6SJustin P. Mattock compressed with LZO compression. LZO compression is mainly 2084b676d2dSPhillip Lougher aimed at embedded systems with slower CPUs where the overheads 2094b676d2dSPhillip Lougher of zlib are too high. 2104b676d2dSPhillip Lougher 2114b676d2dSPhillip Lougher LZO is not the standard compression used in Squashfs and so most 2124b676d2dSPhillip Lougher file systems will be readable without selecting this option. 2134b676d2dSPhillip Lougher 2144b676d2dSPhillip Lougher If unsure, say N. 21579cb8cedSChan Jeong 2167a43ae52SPhillip Lougherconfig SQUASHFS_XZ 2177a43ae52SPhillip Lougher bool "Include support for XZ compressed file systems" 2187a43ae52SPhillip Lougher depends on SQUASHFS 2197a43ae52SPhillip Lougher select XZ_DEC 2207a43ae52SPhillip Lougher help 2217a43ae52SPhillip Lougher Saying Y here includes support for reading Squashfs file systems 22270f23fd6SJustin P. Mattock compressed with XZ compression. XZ gives better compression than 2237a43ae52SPhillip Lougher the default zlib compression, at the expense of greater CPU and 2247a43ae52SPhillip Lougher memory overhead. 2257a43ae52SPhillip Lougher 2267a43ae52SPhillip Lougher XZ is not the standard compression used in Squashfs and so most 2277a43ae52SPhillip Lougher file systems will be readable without selecting this option. 2287a43ae52SPhillip Lougher 2297a43ae52SPhillip Lougher If unsure, say N. 2307a43ae52SPhillip Lougher 23187bf54bbSSean Purcellconfig SQUASHFS_ZSTD 23287bf54bbSSean Purcell bool "Include support for ZSTD compressed file systems" 23387bf54bbSSean Purcell depends on SQUASHFS 23487bf54bbSSean Purcell select ZSTD_DECOMPRESS 23587bf54bbSSean Purcell help 23687bf54bbSSean Purcell Saying Y here includes support for reading Squashfs file systems 23787bf54bbSSean Purcell compressed with ZSTD compression. ZSTD gives better compression than 23887bf54bbSSean Purcell the default ZLIB compression, while using less CPU. 23987bf54bbSSean Purcell 24087bf54bbSSean Purcell ZSTD is not the standard compression used in Squashfs and so most 24187bf54bbSSean Purcell file systems will be readable without selecting this option. 24287bf54bbSSean Purcell 24387bf54bbSSean Purcell If unsure, say N. 24487bf54bbSSean Purcell 2457657cacfSPhillip Lougherconfig SQUASHFS_4K_DEVBLK_SIZE 2467657cacfSPhillip Lougher bool "Use 4K device block size?" 2477657cacfSPhillip Lougher depends on SQUASHFS 2487657cacfSPhillip Lougher help 2497657cacfSPhillip Lougher By default Squashfs sets the dev block size (sb_min_blocksize) 2507657cacfSPhillip Lougher to 1K or the smallest block size supported by the block device 2517657cacfSPhillip Lougher (if larger). This, because blocks are packed together and 2527657cacfSPhillip Lougher unaligned in Squashfs, should reduce latency. 2537657cacfSPhillip Lougher 2547657cacfSPhillip Lougher This, however, gives poor performance on MTD NAND devices where 2557657cacfSPhillip Lougher the optimal I/O size is 4K (even though the devices can support 2567657cacfSPhillip Lougher smaller block sizes). 2577657cacfSPhillip Lougher 2587657cacfSPhillip Lougher Using a 4K device block size may also improve overall I/O 2597657cacfSPhillip Lougher performance for some file access patterns (e.g. sequential 2607657cacfSPhillip Lougher accesses of files in filesystem order) on all media. 2617657cacfSPhillip Lougher 2627657cacfSPhillip Lougher Setting this option will force Squashfs to use a 4K device block 2637657cacfSPhillip Lougher size by default. 2647657cacfSPhillip Lougher 2657657cacfSPhillip Lougher If unsure, say N. 2667657cacfSPhillip Lougher 26722635ec9SAlexey Dobriyanconfig SQUASHFS_EMBEDDED 26822635ec9SAlexey Dobriyan bool "Additional option for memory-constrained systems" 26922635ec9SAlexey Dobriyan depends on SQUASHFS 27022635ec9SAlexey Dobriyan help 27122635ec9SAlexey Dobriyan Saying Y here allows you to specify cache size. 27222635ec9SAlexey Dobriyan 27322635ec9SAlexey Dobriyan If unsure, say N. 27422635ec9SAlexey Dobriyan 27522635ec9SAlexey Dobriyanconfig SQUASHFS_FRAGMENT_CACHE_SIZE 27622635ec9SAlexey Dobriyan int "Number of fragments cached" if SQUASHFS_EMBEDDED 27722635ec9SAlexey Dobriyan depends on SQUASHFS 27822635ec9SAlexey Dobriyan default "3" 27922635ec9SAlexey Dobriyan help 28022635ec9SAlexey Dobriyan By default SquashFS caches the last 3 fragments read from 28122635ec9SAlexey Dobriyan the filesystem. Increasing this amount may mean SquashFS 28222635ec9SAlexey Dobriyan has to re-read fragments less often from disk, at the expense 28322635ec9SAlexey Dobriyan of extra system memory. Decreasing this amount will mean 28422635ec9SAlexey Dobriyan SquashFS uses less memory at the expense of extra reads from disk. 28522635ec9SAlexey Dobriyan 28622635ec9SAlexey Dobriyan Note there must be at least one cached fragment. Anything 28722635ec9SAlexey Dobriyan much more than three will probably not make much difference. 288