1# SPDX-License-Identifier: GPL-2.0-only 2config SQUASHFS 3 tristate "SquashFS 4.0 - Squashed file system support" 4 depends on BLOCK 5 help 6 Saying Y here includes support for SquashFS 4.0 (a Compressed 7 Read-Only File System). Squashfs is a highly compressed read-only 8 filesystem for Linux. It uses zlib, lz4, lzo, xz or zstd compression 9 to compress both files, inodes and directories. Inodes in the system 10 are very small and all blocks are packed to minimise data overhead. 11 Block sizes greater than 4K are supported up to a maximum of 1 Mbytes 12 (default block size 128K). SquashFS 4.0 supports 64 bit filesystems 13 and files (larger than 4GB), full uid/gid information, hard links and 14 timestamps. 15 16 Squashfs is intended for general read-only filesystem use, for 17 archival use (i.e. in cases where a .tar.gz file may be used), and in 18 embedded systems where low overhead is needed. Further information 19 and tools are available from github.com/plougher/squashfs-tools. 20 21 If you want to compile this as a module ( = code which can be 22 inserted in and removed from the running kernel whenever you want), 23 say M here. The module will be called squashfs. Note that the root 24 file system (the one containing the directory /) cannot be compiled 25 as a module. 26 27 If unsure, say N. 28 29choice 30 prompt "File decompression options" 31 depends on SQUASHFS 32 help 33 Squashfs now supports two options for decompressing file 34 data. Traditionally Squashfs has decompressed into an 35 intermediate buffer and then memcopied it into the page cache. 36 Squashfs now supports the ability to decompress directly into 37 the page cache. 38 39 If unsure, select "Decompress file data into an intermediate buffer" 40 41config SQUASHFS_FILE_CACHE 42 bool "Decompress file data into an intermediate buffer" 43 help 44 Decompress file data into an intermediate buffer and then 45 memcopy it into the page cache. 46 47config SQUASHFS_FILE_DIRECT 48 bool "Decompress files directly into the page cache" 49 help 50 Directly decompress file data into the page cache. 51 Doing so can significantly improve performance because 52 it eliminates a memcpy and it also removes the lock contention 53 on the single buffer. 54 55endchoice 56 57config SQUASHFS_DECOMP_SINGLE 58 depends on SQUASHFS 59 def_bool n 60 61config SQUASHFS_DECOMP_MULTI 62 depends on SQUASHFS 63 def_bool n 64 65config SQUASHFS_DECOMP_MULTI_PERCPU 66 depends on SQUASHFS 67 def_bool n 68 69config SQUASHFS_CHOICE_DECOMP_BY_MOUNT 70 bool "Select the parallel decompression mode during mount" 71 depends on SQUASHFS 72 default n 73 select SQUASHFS_DECOMP_SINGLE 74 select SQUASHFS_DECOMP_MULTI 75 select SQUASHFS_DECOMP_MULTI_PERCPU 76 select SQUASHFS_MOUNT_DECOMP_THREADS 77 help 78 Compile all parallel decompression modes and specify the 79 decompression mode by setting "threads=" during mount. 80 default Decompressor parallelisation is SQUASHFS_DECOMP_SINGLE 81 82choice 83 prompt "Select decompression parallel mode at compile time" 84 depends on SQUASHFS 85 depends on !SQUASHFS_CHOICE_DECOMP_BY_MOUNT 86 help 87 Squashfs now supports three parallelisation options for 88 decompression. Each one exhibits various trade-offs between 89 decompression performance and CPU and memory usage. 90 91 If in doubt, select "Single threaded compression" 92 93config SQUASHFS_COMPILE_DECOMP_SINGLE 94 bool "Single threaded compression" 95 select SQUASHFS_DECOMP_SINGLE 96 help 97 Traditionally Squashfs has used single-threaded decompression. 98 Only one block (data or metadata) can be decompressed at any 99 one time. This limits CPU and memory usage to a minimum. 100 101config SQUASHFS_COMPILE_DECOMP_MULTI 102 bool "Use multiple decompressors for parallel I/O" 103 select SQUASHFS_DECOMP_MULTI 104 help 105 By default Squashfs uses a single decompressor but it gives 106 poor performance on parallel I/O workloads when using multiple CPU 107 machines due to waiting on decompressor availability. 108 109 If you have a parallel I/O workload and your system has enough memory, 110 using this option may improve overall I/O performance. 111 112 This decompressor implementation uses up to two parallel 113 decompressors per core. It dynamically allocates decompressors 114 on a demand basis. 115 116config SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU 117 bool "Use percpu multiple decompressors for parallel I/O" 118 select SQUASHFS_DECOMP_MULTI_PERCPU 119 help 120 By default Squashfs uses a single decompressor but it gives 121 poor performance on parallel I/O workloads when using multiple CPU 122 machines due to waiting on decompressor availability. 123 124 This decompressor implementation uses a maximum of one 125 decompressor per core. It uses percpu variables to ensure 126 decompression is load-balanced across the cores. 127endchoice 128 129config SQUASHFS_MOUNT_DECOMP_THREADS 130 bool "Add the mount parameter 'threads=' for squashfs" 131 depends on SQUASHFS 132 depends on SQUASHFS_DECOMP_MULTI 133 default n 134 help 135 Use threads= to set the decompression parallel mode and the number of threads. 136 If SQUASHFS_CHOICE_DECOMP_BY_MOUNT=y 137 threads=<single|multi|percpu|1|2|3|...> 138 else 139 threads=<2|3|...> 140 The upper limit is num_online_cpus() * 2. 141 142config SQUASHFS_XATTR 143 bool "Squashfs XATTR support" 144 depends on SQUASHFS 145 help 146 Saying Y here includes support for extended attributes (xattrs). 147 Xattrs are name:value pairs associated with inodes by 148 the kernel or by users (see the attr(5) manual page). 149 150 If unsure, say N. 151 152config SQUASHFS_COMP_CACHE_FULL 153 bool "Enable full caching of compressed blocks" 154 depends on SQUASHFS 155 default n 156 help 157 This option enables caching of all compressed blocks, Without caching, 158 repeated reads of the same files trigger excessive disk I/O, significantly 159 reducinng performance in workloads like fio-based benchmarks. 160 161 For example, fio tests (iodepth=1, numjobs=1, ioengine=psync) show: 162 With caching: IOPS=2223, BW=278MiB/s (291MB/s) 163 Without caching: IOPS=815, BW=102MiB/s (107MB/s) 164 165 Enabling this option restores performance to pre-regression levels by 166 caching all compressed blocks in the page cache, reducing disk I/O for 167 repeated reads. However, this increases memory usage, which may be a 168 concern in memory-constrained environments. 169 170 Enable this option if your workload involves frequent repeated reads and 171 memory usage is not a limiting factor. If unsure, say N. 172 173config SQUASHFS_ZLIB 174 bool "Include support for ZLIB compressed file systems" 175 depends on SQUASHFS 176 select ZLIB_INFLATE 177 default y 178 help 179 ZLIB compression is the standard compression used by Squashfs 180 file systems. It offers a good trade-off between compression 181 achieved and the amount of CPU time and memory necessary to 182 compress and decompress. 183 184 If unsure, say Y. 185 186config SQUASHFS_LZ4 187 bool "Include support for LZ4 compressed file systems" 188 depends on SQUASHFS 189 select LZ4_DECOMPRESS 190 help 191 Saying Y here includes support for reading Squashfs file systems 192 compressed with LZ4 compression. LZ4 compression is mainly 193 aimed at embedded systems with slower CPUs where the overheads 194 of zlib are too high. 195 196 LZ4 is not the standard compression used in Squashfs and so most 197 file systems will be readable without selecting this option. 198 199 If unsure, say N. 200 201config SQUASHFS_LZO 202 bool "Include support for LZO compressed file systems" 203 depends on SQUASHFS 204 select LZO_DECOMPRESS 205 help 206 Saying Y here includes support for reading Squashfs file systems 207 compressed with LZO compression. LZO compression is mainly 208 aimed at embedded systems with slower CPUs where the overheads 209 of zlib are too high. 210 211 LZO is not the standard compression used in Squashfs and so most 212 file systems will be readable without selecting this option. 213 214 If unsure, say N. 215 216config SQUASHFS_XZ 217 bool "Include support for XZ compressed file systems" 218 depends on SQUASHFS 219 select XZ_DEC 220 help 221 Saying Y here includes support for reading Squashfs file systems 222 compressed with XZ compression. XZ gives better compression than 223 the default zlib compression, at the expense of greater CPU and 224 memory overhead. 225 226 XZ is not the standard compression used in Squashfs and so most 227 file systems will be readable without selecting this option. 228 229 If unsure, say N. 230 231config SQUASHFS_ZSTD 232 bool "Include support for ZSTD compressed file systems" 233 depends on SQUASHFS 234 select ZSTD_DECOMPRESS 235 help 236 Saying Y here includes support for reading Squashfs file systems 237 compressed with ZSTD compression. ZSTD gives better compression than 238 the default ZLIB compression, while using less CPU. 239 240 ZSTD is not the standard compression used in Squashfs and so most 241 file systems will be readable without selecting this option. 242 243 If unsure, say N. 244 245config SQUASHFS_4K_DEVBLK_SIZE 246 bool "Use 4K device block size?" 247 depends on SQUASHFS 248 help 249 By default Squashfs sets the dev block size (sb_min_blocksize) 250 to 1K or the smallest block size supported by the block device 251 (if larger). This, because blocks are packed together and 252 unaligned in Squashfs, should reduce latency. 253 254 This, however, gives poor performance on MTD NAND devices where 255 the optimal I/O size is 4K (even though the devices can support 256 smaller block sizes). 257 258 Using a 4K device block size may also improve overall I/O 259 performance for some file access patterns (e.g. sequential 260 accesses of files in filesystem order) on all media. 261 262 Setting this option will force Squashfs to use a 4K device block 263 size by default. 264 265 If unsure, say N. 266 267config SQUASHFS_EMBEDDED 268 bool "Additional option for memory-constrained systems" 269 depends on SQUASHFS 270 help 271 Saying Y here allows you to specify cache size. 272 273 If unsure, say N. 274 275config SQUASHFS_FRAGMENT_CACHE_SIZE 276 int "Number of fragments cached" if SQUASHFS_EMBEDDED 277 depends on SQUASHFS 278 default "3" 279 help 280 By default SquashFS caches the last 3 fragments read from 281 the filesystem. Increasing this amount may mean SquashFS 282 has to re-read fragments less often from disk, at the expense 283 of extra system memory. Decreasing this amount will mean 284 SquashFS uses less memory at the expense of extra reads from disk. 285 286 Note there must be at least one cached fragment. Anything 287 much more than three will probably not make much difference. 288