xref: /linux/fs/squashfs/Kconfig (revision c159dfbdd4fc62fa08f6715d9d6c34d39cf40446)
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
8*d7f4b23cSPhillip Lougher	  filesystem for Linux.  It uses zlib, lz4, lzo, xz or zstd compression
9*d7f4b23cSPhillip 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
19*d7f4b23cSPhillip 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
152cc6d3497SPhillip Lougherconfig SQUASHFS_ZLIB
153cc6d3497SPhillip Lougher	bool "Include support for ZLIB compressed file systems"
154cc6d3497SPhillip Lougher	depends on SQUASHFS
155cc6d3497SPhillip Lougher	select ZLIB_INFLATE
156cc6d3497SPhillip Lougher	default y
157cc6d3497SPhillip Lougher	help
158cc6d3497SPhillip Lougher	  ZLIB compression is the standard compression used by Squashfs
159cc6d3497SPhillip Lougher	  file systems.  It offers a good trade-off between compression
160cc6d3497SPhillip Lougher	  achieved and the amount of CPU time and memory necessary to
161cc6d3497SPhillip Lougher	  compress and decompress.
162cc6d3497SPhillip Lougher
163cc6d3497SPhillip Lougher	  If unsure, say Y.
164cc6d3497SPhillip Lougher
16562421645SPhillip Lougherconfig SQUASHFS_LZ4
16662421645SPhillip Lougher	bool "Include support for LZ4 compressed file systems"
16762421645SPhillip Lougher	depends on SQUASHFS
16862421645SPhillip Lougher	select LZ4_DECOMPRESS
16962421645SPhillip Lougher	help
17062421645SPhillip Lougher	  Saying Y here includes support for reading Squashfs file systems
17162421645SPhillip Lougher	  compressed with LZ4 compression.  LZ4 compression is mainly
17262421645SPhillip Lougher	  aimed at embedded systems with slower CPUs where the overheads
17362421645SPhillip Lougher	  of zlib are too high.
17462421645SPhillip Lougher
17562421645SPhillip Lougher	  LZ4 is not the standard compression used in Squashfs and so most
17662421645SPhillip Lougher	  file systems will be readable without selecting this option.
17762421645SPhillip Lougher
17862421645SPhillip Lougher	  If unsure, say N.
17962421645SPhillip Lougher
18079cb8cedSChan Jeongconfig SQUASHFS_LZO
18179cb8cedSChan Jeong	bool "Include support for LZO compressed file systems"
18279cb8cedSChan Jeong	depends on SQUASHFS
18379cb8cedSChan Jeong	select LZO_DECOMPRESS
1844b676d2dSPhillip Lougher	help
1854b676d2dSPhillip Lougher	  Saying Y here includes support for reading Squashfs file systems
18670f23fd6SJustin P. Mattock	  compressed with LZO compression.  LZO compression is mainly
1874b676d2dSPhillip Lougher	  aimed at embedded systems with slower CPUs where the overheads
1884b676d2dSPhillip Lougher	  of zlib are too high.
1894b676d2dSPhillip Lougher
1904b676d2dSPhillip Lougher	  LZO is not the standard compression used in Squashfs and so most
1914b676d2dSPhillip Lougher	  file systems will be readable without selecting this option.
1924b676d2dSPhillip Lougher
1934b676d2dSPhillip Lougher	  If unsure, say N.
19479cb8cedSChan Jeong
1957a43ae52SPhillip Lougherconfig SQUASHFS_XZ
1967a43ae52SPhillip Lougher	bool "Include support for XZ compressed file systems"
1977a43ae52SPhillip Lougher	depends on SQUASHFS
1987a43ae52SPhillip Lougher	select XZ_DEC
1997a43ae52SPhillip Lougher	help
2007a43ae52SPhillip Lougher	  Saying Y here includes support for reading Squashfs file systems
20170f23fd6SJustin P. Mattock	  compressed with XZ compression.  XZ gives better compression than
2027a43ae52SPhillip Lougher	  the default zlib compression, at the expense of greater CPU and
2037a43ae52SPhillip Lougher	  memory overhead.
2047a43ae52SPhillip Lougher
2057a43ae52SPhillip Lougher	  XZ is not the standard compression used in Squashfs and so most
2067a43ae52SPhillip Lougher	  file systems will be readable without selecting this option.
2077a43ae52SPhillip Lougher
2087a43ae52SPhillip Lougher	  If unsure, say N.
2097a43ae52SPhillip Lougher
21087bf54bbSSean Purcellconfig SQUASHFS_ZSTD
21187bf54bbSSean Purcell	bool "Include support for ZSTD compressed file systems"
21287bf54bbSSean Purcell	depends on SQUASHFS
21387bf54bbSSean Purcell	select ZSTD_DECOMPRESS
21487bf54bbSSean Purcell	help
21587bf54bbSSean Purcell	  Saying Y here includes support for reading Squashfs file systems
21687bf54bbSSean Purcell	  compressed with ZSTD compression.  ZSTD gives better compression than
21787bf54bbSSean Purcell	  the default ZLIB compression, while using less CPU.
21887bf54bbSSean Purcell
21987bf54bbSSean Purcell	  ZSTD is not the standard compression used in Squashfs and so most
22087bf54bbSSean Purcell	  file systems will be readable without selecting this option.
22187bf54bbSSean Purcell
22287bf54bbSSean Purcell	  If unsure, say N.
22387bf54bbSSean Purcell
2247657cacfSPhillip Lougherconfig SQUASHFS_4K_DEVBLK_SIZE
2257657cacfSPhillip Lougher	bool "Use 4K device block size?"
2267657cacfSPhillip Lougher	depends on SQUASHFS
2277657cacfSPhillip Lougher	help
2287657cacfSPhillip Lougher	  By default Squashfs sets the dev block size (sb_min_blocksize)
2297657cacfSPhillip Lougher	  to 1K or the smallest block size supported by the block device
2307657cacfSPhillip Lougher	  (if larger).  This, because blocks are packed together and
2317657cacfSPhillip Lougher	  unaligned in Squashfs, should reduce latency.
2327657cacfSPhillip Lougher
2337657cacfSPhillip Lougher	  This, however, gives poor performance on MTD NAND devices where
2347657cacfSPhillip Lougher	  the optimal I/O size is 4K (even though the devices can support
2357657cacfSPhillip Lougher	  smaller block sizes).
2367657cacfSPhillip Lougher
2377657cacfSPhillip Lougher	  Using a 4K device block size may also improve overall I/O
2387657cacfSPhillip Lougher	  performance for some file access patterns (e.g. sequential
2397657cacfSPhillip Lougher	  accesses of files in filesystem order) on all media.
2407657cacfSPhillip Lougher
2417657cacfSPhillip Lougher	  Setting this option will force Squashfs to use a 4K device block
2427657cacfSPhillip Lougher	  size by default.
2437657cacfSPhillip Lougher
2447657cacfSPhillip Lougher	  If unsure, say N.
2457657cacfSPhillip Lougher
24622635ec9SAlexey Dobriyanconfig SQUASHFS_EMBEDDED
24722635ec9SAlexey Dobriyan	bool "Additional option for memory-constrained systems"
24822635ec9SAlexey Dobriyan	depends on SQUASHFS
24922635ec9SAlexey Dobriyan	help
25022635ec9SAlexey Dobriyan	  Saying Y here allows you to specify cache size.
25122635ec9SAlexey Dobriyan
25222635ec9SAlexey Dobriyan	  If unsure, say N.
25322635ec9SAlexey Dobriyan
25422635ec9SAlexey Dobriyanconfig SQUASHFS_FRAGMENT_CACHE_SIZE
25522635ec9SAlexey Dobriyan	int "Number of fragments cached" if SQUASHFS_EMBEDDED
25622635ec9SAlexey Dobriyan	depends on SQUASHFS
25722635ec9SAlexey Dobriyan	default "3"
25822635ec9SAlexey Dobriyan	help
25922635ec9SAlexey Dobriyan	  By default SquashFS caches the last 3 fragments read from
26022635ec9SAlexey Dobriyan	  the filesystem.  Increasing this amount may mean SquashFS
26122635ec9SAlexey Dobriyan	  has to re-read fragments less often from disk, at the expense
26222635ec9SAlexey Dobriyan	  of extra system memory.  Decreasing this amount will mean
26322635ec9SAlexey Dobriyan	  SquashFS uses less memory at the expense of extra reads from disk.
26422635ec9SAlexey Dobriyan
26522635ec9SAlexey Dobriyan	  Note there must be at least one cached fragment.  Anything
26622635ec9SAlexey Dobriyan	  much more than three will probably not make much difference.
267