linux-uconsole/fs/squashfs
Sean Purcell 690646e829 UPSTREAM: squashfs: Add zstd support
Add zstd compression and decompression support to SquashFS. zstd is a
great fit for SquashFS because it can compress at ratios approaching xz,
while decompressing twice as fast as zlib. For SquashFS in particular,
it can decompress as fast as lzo and lz4. It also has the flexibility
to turn down the compression ratio for faster compression times.

The compression benchmark is run on the file tree from the SquashFS archive
found in ubuntu-16.10-desktop-amd64.iso [1]. It uses `mksquashfs` with the
default block size (128 KB) and and various compression algorithms/levels.
xz and zstd are also benchmarked with 256 KB blocks. The decompression
benchmark times how long it takes to `tar` the file tree into `/dev/null`.
See the benchmark file in the upstream zstd source repository located under
`contrib/linux-kernel/squashfs-benchmark.sh` [2] for details.

I ran the benchmarks on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
The VM is running on a MacBook Pro with a 3.1 GHz Intel Core i7 processor,
16 GB of RAM, and a SSD.

| Method         | Ratio | Compression MB/s | Decompression MB/s |
|----------------|-------|------------------|--------------------|
| gzip           |  2.92 |               15 |                128 |
| lzo            |  2.64 |              9.5 |                217 |
| lz4            |  2.12 |               94 |                218 |
| xz             |  3.43 |              5.5 |                 35 |
| xz 256 KB      |  3.53 |              5.4 |                 40 |
| zstd 1         |  2.71 |               96 |                210 |
| zstd 5         |  2.93 |               69 |                198 |
| zstd 10        |  3.01 |               41 |                225 |
| zstd 15        |  3.13 |             11.4 |                224 |
| zstd 16 256 KB |  3.24 |              8.1 |                210 |

This patch was written by Sean Purcell <me@seanp.xyz>, but I will be
taking over the submission process.

[1] http://releases.ubuntu.com/16.10/
[2] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/squashfs-benchmark.sh

zstd source repository: https://github.com/facebook/zstd

Change-Id: I6d6d6c1a7f565d7ad28eb01d052604ec7b588a0b
Signed-off-by: Sean Purcell <me@seanp.xyz>
Signed-off-by: Nick Terrell <terrelln@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Acked-by: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry-picked from commit 87bf54bb43)
2018-04-25 16:21:55 +08:00
..
block.c ANDROID: squashfs: Fix endianness issue 2017-07-10 16:28:06 +05:30
cache.c Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
decompressor.c UPSTREAM: squashfs: Add zstd support 2018-04-25 16:21:55 +08:00
decompressor.h UPSTREAM: squashfs: Add zstd support 2018-04-25 16:21:55 +08:00
decompressor_multi.c Squashfs: Check stream is not NULL in decompressor_multi.c 2013-11-20 03:59:20 +00:00
decompressor_multi_percpu.c Squashfs: Generalise paging handling in the decompressors 2013-11-20 03:59:01 +00:00
decompressor_single.c Squashfs: Generalise paging handling in the decompressors 2013-11-20 03:59:01 +00:00
dir.c Squashfs: add corruption check for type in squashfs_readdir() 2013-09-06 04:57:54 +01:00
export.c VFS: normal filesystems (and lustre): d_inode() annotations 2015-04-15 15:06:57 -04:00
file.c Squashfs: implement .readpages() 2017-04-10 13:12:16 +05:30
file_direct.c Squashfs: optimize reading uncompressed data 2017-04-10 13:12:16 +05:30
fragment.c Squashfs: Fix sanity check patches on big-endian systems 2011-05-29 10:03:09 +01:00
id.c Squashfs: Fix sanity check patches on big-endian systems 2011-05-29 10:03:09 +01:00
inode.c userns: Convert squashfs to use kuid/kgid where appropriate 2012-09-21 03:13:35 -07:00
Kconfig UPSTREAM: squashfs: Add zstd support 2018-04-25 16:21:55 +08:00
lz4_wrapper.c Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
lzo_wrapper.c Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
Makefile UPSTREAM: squashfs: Add zstd support 2018-04-25 16:21:55 +08:00
namei.c Squashfs: fix corruption checks in squashfs_lookup() 2013-09-06 04:57:53 +01:00
page_actor.c Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
page_actor.h Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
squashfs.h Squashfs: implement .readpages() 2017-04-10 13:12:16 +05:30
squashfs_fs.h UPSTREAM: squashfs: Add zstd support 2018-04-25 16:21:55 +08:00
squashfs_fs_i.h fs: cleanup slight list_entry abuse 2015-06-23 18:01:59 -04:00
squashfs_fs_sb.h Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
super.c Squashfs: replace buffer_head with BIO 2017-04-10 13:12:16 +05:30
symlink.c squashfs: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:25 +08:00
xattr.c squashfs: xattr simplifications 2015-11-13 20:34:33 -05:00
xattr.h Squashfs: update email address 2011-05-26 10:49:11 +01:00
xattr_id.c Squashfs: update email address 2011-05-26 10:49:11 +01:00
xz_wrapper.c Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
zlib_wrapper.c Squashfs: refactor page_actor 2017-04-10 13:12:16 +05:30
zstd_wrapper.c UPSTREAM: squashfs: Add zstd support 2018-04-25 16:21:55 +08:00