162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ciconfig SQUASHFS
362306a36Sopenharmony_ci	tristate "SquashFS 4.0 - Squashed file system support"
462306a36Sopenharmony_ci	depends on BLOCK
562306a36Sopenharmony_ci	help
662306a36Sopenharmony_ci	  Saying Y here includes support for SquashFS 4.0 (a Compressed
762306a36Sopenharmony_ci	  Read-Only File System).  Squashfs is a highly compressed read-only
862306a36Sopenharmony_ci	  filesystem for Linux.  It uses zlib, lzo or xz compression to
962306a36Sopenharmony_ci	  compress both files, inodes and directories.  Inodes in the system
1062306a36Sopenharmony_ci	  are very small and all blocks are packed to minimise data overhead.
1162306a36Sopenharmony_ci	  Block sizes greater than 4K are supported up to a maximum of 1 Mbytes
1262306a36Sopenharmony_ci	  (default block size 128K).  SquashFS 4.0 supports 64 bit filesystems
1362306a36Sopenharmony_ci	  and files (larger than 4GB), full uid/gid information, hard links and
1462306a36Sopenharmony_ci	  timestamps.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci	  Squashfs is intended for general read-only filesystem use, for
1762306a36Sopenharmony_ci	  archival use (i.e. in cases where a .tar.gz file may be used), and in
1862306a36Sopenharmony_ci	  embedded systems where low overhead is needed.  Further information
1962306a36Sopenharmony_ci	  and tools are available from http://squashfs.sourceforge.net.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci	  If you want to compile this as a module ( = code which can be
2262306a36Sopenharmony_ci	  inserted in and removed from the running kernel whenever you want),
2362306a36Sopenharmony_ci	  say M here.  The module will be called squashfs.  Note that the root
2462306a36Sopenharmony_ci	  file system (the one containing the directory /) cannot be compiled
2562306a36Sopenharmony_ci	  as a module.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci	  If unsure, say N.
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cichoice
3062306a36Sopenharmony_ci	prompt "File decompression options"
3162306a36Sopenharmony_ci	depends on SQUASHFS
3262306a36Sopenharmony_ci	help
3362306a36Sopenharmony_ci	  Squashfs now supports two options for decompressing file
3462306a36Sopenharmony_ci	  data.  Traditionally Squashfs has decompressed into an
3562306a36Sopenharmony_ci	  intermediate buffer and then memcopied it into the page cache.
3662306a36Sopenharmony_ci	  Squashfs now supports the ability to decompress directly into
3762306a36Sopenharmony_ci	  the page cache.
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci	  If unsure, select "Decompress file data into an intermediate buffer"
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciconfig SQUASHFS_FILE_CACHE
4262306a36Sopenharmony_ci	bool "Decompress file data into an intermediate buffer"
4362306a36Sopenharmony_ci	help
4462306a36Sopenharmony_ci	  Decompress file data into an intermediate buffer and then
4562306a36Sopenharmony_ci	  memcopy it into the page cache.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciconfig SQUASHFS_FILE_DIRECT
4862306a36Sopenharmony_ci	bool "Decompress files directly into the page cache"
4962306a36Sopenharmony_ci	help
5062306a36Sopenharmony_ci	  Directly decompress file data into the page cache.
5162306a36Sopenharmony_ci	  Doing so can significantly improve performance because
5262306a36Sopenharmony_ci	  it eliminates a memcpy and it also removes the lock contention
5362306a36Sopenharmony_ci	  on the single buffer.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciendchoice
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ciconfig SQUASHFS_DECOMP_SINGLE
5862306a36Sopenharmony_ci	depends on SQUASHFS
5962306a36Sopenharmony_ci	def_bool n
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciconfig SQUASHFS_DECOMP_MULTI
6262306a36Sopenharmony_ci	depends on SQUASHFS
6362306a36Sopenharmony_ci	def_bool n
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ciconfig SQUASHFS_DECOMP_MULTI_PERCPU
6662306a36Sopenharmony_ci	depends on SQUASHFS
6762306a36Sopenharmony_ci	def_bool n
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ciconfig SQUASHFS_CHOICE_DECOMP_BY_MOUNT
7062306a36Sopenharmony_ci	bool "Select the parallel decompression mode during mount"
7162306a36Sopenharmony_ci	depends on SQUASHFS
7262306a36Sopenharmony_ci	default n
7362306a36Sopenharmony_ci	select SQUASHFS_DECOMP_SINGLE
7462306a36Sopenharmony_ci	select SQUASHFS_DECOMP_MULTI
7562306a36Sopenharmony_ci	select SQUASHFS_DECOMP_MULTI_PERCPU
7662306a36Sopenharmony_ci	select SQUASHFS_MOUNT_DECOMP_THREADS
7762306a36Sopenharmony_ci	help
7862306a36Sopenharmony_ci	  Compile all parallel decompression modes and specify the
7962306a36Sopenharmony_ci	  decompression mode by setting "threads=" during mount.
8062306a36Sopenharmony_ci	  default Decompressor parallelisation is SQUASHFS_DECOMP_SINGLE
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_cichoice
8362306a36Sopenharmony_ci	prompt "Select decompression parallel mode at compile time"
8462306a36Sopenharmony_ci	depends on SQUASHFS
8562306a36Sopenharmony_ci	depends on !SQUASHFS_CHOICE_DECOMP_BY_MOUNT
8662306a36Sopenharmony_ci	help
8762306a36Sopenharmony_ci	  Squashfs now supports three parallelisation options for
8862306a36Sopenharmony_ci	  decompression.  Each one exhibits various trade-offs between
8962306a36Sopenharmony_ci	  decompression performance and CPU and memory usage.
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci	  If in doubt, select "Single threaded compression"
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ciconfig SQUASHFS_COMPILE_DECOMP_SINGLE
9462306a36Sopenharmony_ci	bool "Single threaded compression"
9562306a36Sopenharmony_ci	select SQUASHFS_DECOMP_SINGLE
9662306a36Sopenharmony_ci	help
9762306a36Sopenharmony_ci	  Traditionally Squashfs has used single-threaded decompression.
9862306a36Sopenharmony_ci	  Only one block (data or metadata) can be decompressed at any
9962306a36Sopenharmony_ci	  one time.  This limits CPU and memory usage to a minimum.
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ciconfig SQUASHFS_COMPILE_DECOMP_MULTI
10262306a36Sopenharmony_ci	bool "Use multiple decompressors for parallel I/O"
10362306a36Sopenharmony_ci	select SQUASHFS_DECOMP_MULTI
10462306a36Sopenharmony_ci	help
10562306a36Sopenharmony_ci	  By default Squashfs uses a single decompressor but it gives
10662306a36Sopenharmony_ci	  poor performance on parallel I/O workloads when using multiple CPU
10762306a36Sopenharmony_ci	  machines due to waiting on decompressor availability.
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci	  If you have a parallel I/O workload and your system has enough memory,
11062306a36Sopenharmony_ci	  using this option may improve overall I/O performance.
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci	  This decompressor implementation uses up to two parallel
11362306a36Sopenharmony_ci	  decompressors per core.  It dynamically allocates decompressors
11462306a36Sopenharmony_ci	  on a demand basis.
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciconfig SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU
11762306a36Sopenharmony_ci	bool "Use percpu multiple decompressors for parallel I/O"
11862306a36Sopenharmony_ci	select SQUASHFS_DECOMP_MULTI_PERCPU
11962306a36Sopenharmony_ci	help
12062306a36Sopenharmony_ci	  By default Squashfs uses a single decompressor but it gives
12162306a36Sopenharmony_ci	  poor performance on parallel I/O workloads when using multiple CPU
12262306a36Sopenharmony_ci	  machines due to waiting on decompressor availability.
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci	  This decompressor implementation uses a maximum of one
12562306a36Sopenharmony_ci	  decompressor per core.  It uses percpu variables to ensure
12662306a36Sopenharmony_ci	  decompression is load-balanced across the cores.
12762306a36Sopenharmony_ciendchoice
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciconfig SQUASHFS_MOUNT_DECOMP_THREADS
13062306a36Sopenharmony_ci	bool "Add the mount parameter 'threads=' for squashfs"
13162306a36Sopenharmony_ci	depends on SQUASHFS
13262306a36Sopenharmony_ci	depends on SQUASHFS_DECOMP_MULTI
13362306a36Sopenharmony_ci	default n
13462306a36Sopenharmony_ci	help
13562306a36Sopenharmony_ci	  Use threads= to set the decompression parallel mode and the number of threads.
13662306a36Sopenharmony_ci	  If SQUASHFS_CHOICE_DECOMP_BY_MOUNT=y
13762306a36Sopenharmony_ci	      threads=<single|multi|percpu|1|2|3|...>
13862306a36Sopenharmony_ci	  else
13962306a36Sopenharmony_ci	      threads=<2|3|...>
14062306a36Sopenharmony_ci	  The upper limit is num_online_cpus() * 2.
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ciconfig SQUASHFS_XATTR
14362306a36Sopenharmony_ci	bool "Squashfs XATTR support"
14462306a36Sopenharmony_ci	depends on SQUASHFS
14562306a36Sopenharmony_ci	help
14662306a36Sopenharmony_ci	  Saying Y here includes support for extended attributes (xattrs).
14762306a36Sopenharmony_ci	  Xattrs are name:value pairs associated with inodes by
14862306a36Sopenharmony_ci	  the kernel or by users (see the attr(5) manual page).
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci	  If unsure, say N.
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ciconfig SQUASHFS_ZLIB
15362306a36Sopenharmony_ci	bool "Include support for ZLIB compressed file systems"
15462306a36Sopenharmony_ci	depends on SQUASHFS
15562306a36Sopenharmony_ci	select ZLIB_INFLATE
15662306a36Sopenharmony_ci	default y
15762306a36Sopenharmony_ci	help
15862306a36Sopenharmony_ci	  ZLIB compression is the standard compression used by Squashfs
15962306a36Sopenharmony_ci	  file systems.  It offers a good trade-off between compression
16062306a36Sopenharmony_ci	  achieved and the amount of CPU time and memory necessary to
16162306a36Sopenharmony_ci	  compress and decompress.
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci	  If unsure, say Y.
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ciconfig SQUASHFS_LZ4
16662306a36Sopenharmony_ci	bool "Include support for LZ4 compressed file systems"
16762306a36Sopenharmony_ci	depends on SQUASHFS
16862306a36Sopenharmony_ci	select LZ4_DECOMPRESS
16962306a36Sopenharmony_ci	help
17062306a36Sopenharmony_ci	  Saying Y here includes support for reading Squashfs file systems
17162306a36Sopenharmony_ci	  compressed with LZ4 compression.  LZ4 compression is mainly
17262306a36Sopenharmony_ci	  aimed at embedded systems with slower CPUs where the overheads
17362306a36Sopenharmony_ci	  of zlib are too high.
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci	  LZ4 is not the standard compression used in Squashfs and so most
17662306a36Sopenharmony_ci	  file systems will be readable without selecting this option.
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci	  If unsure, say N.
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ciconfig SQUASHFS_LZO
18162306a36Sopenharmony_ci	bool "Include support for LZO compressed file systems"
18262306a36Sopenharmony_ci	depends on SQUASHFS
18362306a36Sopenharmony_ci	select LZO_DECOMPRESS
18462306a36Sopenharmony_ci	help
18562306a36Sopenharmony_ci	  Saying Y here includes support for reading Squashfs file systems
18662306a36Sopenharmony_ci	  compressed with LZO compression.  LZO compression is mainly
18762306a36Sopenharmony_ci	  aimed at embedded systems with slower CPUs where the overheads
18862306a36Sopenharmony_ci	  of zlib are too high.
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci	  LZO is not the standard compression used in Squashfs and so most
19162306a36Sopenharmony_ci	  file systems will be readable without selecting this option.
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci	  If unsure, say N.
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ciconfig SQUASHFS_XZ
19662306a36Sopenharmony_ci	bool "Include support for XZ compressed file systems"
19762306a36Sopenharmony_ci	depends on SQUASHFS
19862306a36Sopenharmony_ci	select XZ_DEC
19962306a36Sopenharmony_ci	help
20062306a36Sopenharmony_ci	  Saying Y here includes support for reading Squashfs file systems
20162306a36Sopenharmony_ci	  compressed with XZ compression.  XZ gives better compression than
20262306a36Sopenharmony_ci	  the default zlib compression, at the expense of greater CPU and
20362306a36Sopenharmony_ci	  memory overhead.
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci	  XZ is not the standard compression used in Squashfs and so most
20662306a36Sopenharmony_ci	  file systems will be readable without selecting this option.
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci	  If unsure, say N.
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ciconfig SQUASHFS_ZSTD
21162306a36Sopenharmony_ci	bool "Include support for ZSTD compressed file systems"
21262306a36Sopenharmony_ci	depends on SQUASHFS
21362306a36Sopenharmony_ci	select ZSTD_DECOMPRESS
21462306a36Sopenharmony_ci	help
21562306a36Sopenharmony_ci	  Saying Y here includes support for reading Squashfs file systems
21662306a36Sopenharmony_ci	  compressed with ZSTD compression.  ZSTD gives better compression than
21762306a36Sopenharmony_ci	  the default ZLIB compression, while using less CPU.
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci	  ZSTD is not the standard compression used in Squashfs and so most
22062306a36Sopenharmony_ci	  file systems will be readable without selecting this option.
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci	  If unsure, say N.
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ciconfig SQUASHFS_4K_DEVBLK_SIZE
22562306a36Sopenharmony_ci	bool "Use 4K device block size?"
22662306a36Sopenharmony_ci	depends on SQUASHFS
22762306a36Sopenharmony_ci	help
22862306a36Sopenharmony_ci	  By default Squashfs sets the dev block size (sb_min_blocksize)
22962306a36Sopenharmony_ci	  to 1K or the smallest block size supported by the block device
23062306a36Sopenharmony_ci	  (if larger).  This, because blocks are packed together and
23162306a36Sopenharmony_ci	  unaligned in Squashfs, should reduce latency.
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci	  This, however, gives poor performance on MTD NAND devices where
23462306a36Sopenharmony_ci	  the optimal I/O size is 4K (even though the devices can support
23562306a36Sopenharmony_ci	  smaller block sizes).
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci	  Using a 4K device block size may also improve overall I/O
23862306a36Sopenharmony_ci	  performance for some file access patterns (e.g. sequential
23962306a36Sopenharmony_ci	  accesses of files in filesystem order) on all media.
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci	  Setting this option will force Squashfs to use a 4K device block
24262306a36Sopenharmony_ci	  size by default.
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci	  If unsure, say N.
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ciconfig SQUASHFS_EMBEDDED
24762306a36Sopenharmony_ci	bool "Additional option for memory-constrained systems"
24862306a36Sopenharmony_ci	depends on SQUASHFS
24962306a36Sopenharmony_ci	help
25062306a36Sopenharmony_ci	  Saying Y here allows you to specify cache size.
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci	  If unsure, say N.
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ciconfig SQUASHFS_FRAGMENT_CACHE_SIZE
25562306a36Sopenharmony_ci	int "Number of fragments cached" if SQUASHFS_EMBEDDED
25662306a36Sopenharmony_ci	depends on SQUASHFS
25762306a36Sopenharmony_ci	default "3"
25862306a36Sopenharmony_ci	help
25962306a36Sopenharmony_ci	  By default SquashFS caches the last 3 fragments read from
26062306a36Sopenharmony_ci	  the filesystem.  Increasing this amount may mean SquashFS
26162306a36Sopenharmony_ci	  has to re-read fragments less often from disk, at the expense
26262306a36Sopenharmony_ci	  of extra system memory.  Decreasing this amount will mean
26362306a36Sopenharmony_ci	  SquashFS uses less memory at the expense of extra reads from disk.
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci	  Note there must be at least one cached fragment.  Anything
26662306a36Sopenharmony_ci	  much more than three will probably not make much difference.
267