Squashfs supports three decompression concurrency modes:
Single-thread mode: concurrent reads are blocked and the memory overhead
is small.
Multi-thread mode/percpu mode: reduces concurrent read blocking but
increases memory overhead.
The corresponding schema must be fixed at compile time. During mounting,
the concurrent decompression mode cannot be adjusted based on file read
blocking.
The mount parameter theads=<single|multi|percpu> is added to select
the concurrent decompression mode of a single SquashFS file system
image.
Signed-off-by: Xiaoming Ni <nixiaoming@xxxxxxxxxx>
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 32565dafa7f3..fd4e70d45f3c 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -47,10 +47,12 @@ enum Opt_errors {
+#ifdef CONFIG_SQUASHFS_DECOMP_SINGLE
+ opts->thread_ops = &squashfs_decompressor_single; > +#elif CONFIG_SQUASHFS_DECOMP_MULTI
+ opts->thread_ops = &squashfs_decompressor_multi;
+#elif CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU
+ opts->thread_ops = &squashfs_decompressor_percpu;
+#endif
fc->fs_private = opts;
fc->ops = &squashfs_context_ops;
return 0;