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, lzo or xz compression to
9	  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 http://squashfs.sourceforge.net.
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
57choice
58	prompt "Decompressor parallelisation options"
59	depends on SQUASHFS
60	help
61	  Squashfs now supports three parallelisation options for
62	  decompression.  Each one exhibits various trade-offs between
63	  decompression performance and CPU and memory usage.
64
65	  If in doubt, select "Single threaded compression"
66
67config SQUASHFS_DECOMP_SINGLE
68	bool "Single threaded compression"
69	help
70	  Traditionally Squashfs has used single-threaded decompression.
71	  Only one block (data or metadata) can be decompressed at any
72	  one time.  This limits CPU and memory usage to a minimum.
73
74config SQUASHFS_DECOMP_MULTI
75	bool "Use multiple decompressors for parallel I/O"
76	help
77	  By default Squashfs uses a single decompressor but it gives
78	  poor performance on parallel I/O workloads when using multiple CPU
79	  machines due to waiting on decompressor availability.
80
81	  If you have a parallel I/O workload and your system has enough memory,
82	  using this option may improve overall I/O performance.
83
84	  This decompressor implementation uses up to two parallel
85	  decompressors per core.  It dynamically allocates decompressors
86	  on a demand basis.
87
88config SQUASHFS_DECOMP_MULTI_PERCPU
89	bool "Use percpu multiple decompressors for parallel I/O"
90	help
91	  By default Squashfs uses a single decompressor but it gives
92	  poor performance on parallel I/O workloads when using multiple CPU
93	  machines due to waiting on decompressor availability.
94
95	  This decompressor implementation uses a maximum of one
96	  decompressor per core.  It uses percpu variables to ensure
97	  decompression is load-balanced across the cores.
98
99endchoice
100
101config SQUASHFS_XATTR
102	bool "Squashfs XATTR support"
103	depends on SQUASHFS
104	help
105	  Saying Y here includes support for extended attributes (xattrs).
106	  Xattrs are name:value pairs associated with inodes by
107	  the kernel or by users (see the attr(5) manual page).
108
109	  If unsure, say N.
110
111config SQUASHFS_ZLIB
112	bool "Include support for ZLIB compressed file systems"
113	depends on SQUASHFS
114	select ZLIB_INFLATE
115	default y
116	help
117	  ZLIB compression is the standard compression used by Squashfs
118	  file systems.  It offers a good trade-off between compression
119	  achieved and the amount of CPU time and memory necessary to
120	  compress and decompress.
121
122	  If unsure, say Y.
123
124config SQUASHFS_LZ4
125	bool "Include support for LZ4 compressed file systems"
126	depends on SQUASHFS
127	select LZ4_DECOMPRESS
128	help
129	  Saying Y here includes support for reading Squashfs file systems
130	  compressed with LZ4 compression.  LZ4 compression is mainly
131	  aimed at embedded systems with slower CPUs where the overheads
132	  of zlib are too high.
133
134	  LZ4 is not the standard compression used in Squashfs and so most
135	  file systems will be readable without selecting this option.
136
137	  If unsure, say N.
138
139config SQUASHFS_LZO
140	bool "Include support for LZO compressed file systems"
141	depends on SQUASHFS
142	select LZO_DECOMPRESS
143	help
144	  Saying Y here includes support for reading Squashfs file systems
145	  compressed with LZO compression.  LZO compression is mainly
146	  aimed at embedded systems with slower CPUs where the overheads
147	  of zlib are too high.
148
149	  LZO is not the standard compression used in Squashfs and so most
150	  file systems will be readable without selecting this option.
151
152	  If unsure, say N.
153
154config SQUASHFS_XZ
155	bool "Include support for XZ compressed file systems"
156	depends on SQUASHFS
157	select XZ_DEC
158	help
159	  Saying Y here includes support for reading Squashfs file systems
160	  compressed with XZ compression.  XZ gives better compression than
161	  the default zlib compression, at the expense of greater CPU and
162	  memory overhead.
163
164	  XZ is not the standard compression used in Squashfs and so most
165	  file systems will be readable without selecting this option.
166
167	  If unsure, say N.
168
169config SQUASHFS_ZSTD
170	bool "Include support for ZSTD compressed file systems"
171	depends on SQUASHFS
172	select ZSTD_DECOMPRESS
173	help
174	  Saying Y here includes support for reading Squashfs file systems
175	  compressed with ZSTD compression.  ZSTD gives better compression than
176	  the default ZLIB compression, while using less CPU.
177
178	  ZSTD is not the standard compression used in Squashfs and so most
179	  file systems will be readable without selecting this option.
180
181	  If unsure, say N.
182
183config SQUASHFS_4K_DEVBLK_SIZE
184	bool "Use 4K device block size?"
185	depends on SQUASHFS
186	help
187	  By default Squashfs sets the dev block size (sb_min_blocksize)
188	  to 1K or the smallest block size supported by the block device
189	  (if larger).  This, because blocks are packed together and
190	  unaligned in Squashfs, should reduce latency.
191
192	  This, however, gives poor performance on MTD NAND devices where
193	  the optimal I/O size is 4K (even though the devices can support
194	  smaller block sizes).
195
196	  Using a 4K device block size may also improve overall I/O
197	  performance for some file access patterns (e.g. sequential
198	  accesses of files in filesystem order) on all media.
199
200	  Setting this option will force Squashfs to use a 4K device block
201	  size by default.
202
203	  If unsure, say N.
204
205config SQUASHFS_EMBEDDED
206	bool "Additional option for memory-constrained systems"
207	depends on SQUASHFS
208	help
209	  Saying Y here allows you to specify cache size.
210
211	  If unsure, say N.
212
213config SQUASHFS_FRAGMENT_CACHE_SIZE
214	int "Number of fragments cached" if SQUASHFS_EMBEDDED
215	depends on SQUASHFS
216	default "3"
217	help
218	  By default SquashFS caches the last 3 fragments read from
219	  the filesystem.  Increasing this amount may mean SquashFS
220	  has to re-read fragments less often from disk, at the expense
221	  of extra system memory.  Decreasing this amount will mean
222	  SquashFS uses less memory at the expense of extra reads from disk.
223
224	  Note there must be at least one cached fragment.  Anything
225	  much more than three will probably not make much difference.
226