Skip to content

Commit b668bad

Browse files
committed
Merge branch 'dev' of github.com:facebook/zstd into dev
2 parents c08e568 + ddcffbf commit b668bad

File tree

2 files changed

+79
-3
lines changed

2 files changed

+79
-3
lines changed

contrib/linux-kernel/README.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Linux Kernel Patch
22

3-
There are two pieces, the `zstd_compress` and `zstd_decompress` kernel modules, and the BtrFS patch.
3+
There are three pieces, the `zstd_compress` and `zstd_decompress` kernel modules, the BtrFS patch, and the SquashFS patch.
44
The patches are based off of the linux kernel master branch (version 4.10).
55

66
## Zstd Kernel modules
@@ -22,14 +22,15 @@ The patches are based off of the linux kernel master branch (version 4.10).
2222

2323
* The patch is located in `btrfs.diff`.
2424
* Additionally `fs/btrfs/zstd.c` is provided as a source for convenience.
25-
* The patch seems to be working, it doesn't crash the kernel, and compresses at speeds and ratios athat are expected.
26-
It can still use some more testing for fringe features, like printing options.
25+
* The patch seems to be working, it doesn't crash the kernel, and compresses at speeds and ratios that are expected.
26+
It could still use some more testing for fringe features, like printing options.
2727

2828
### Benchmarks
2929

3030
Benchmarks run on a Ubuntu 14.04 with 2 cores and 4 GiB of RAM.
3131
The VM is running on a Macbook Pro with a 3.1 GHz Intel Core i7 processor,
3232
16 GB of ram, and a SSD.
33+
The kernel running was built from the master branch with the patch (version 4.10).
3334

3435
The compression benchmark is copying 10 copies of the
3536
unzipped [silesia corpus](http://mattmahoney.net/dc/silesia.html) into a BtrFS
@@ -50,3 +51,39 @@ See `btrfs-benchmark.sh` for details.
5051
| zstd 9 | 2.92 | 43 MB/s | 406 MB/s |
5152
| zstd 12 | 2.93 | 21 MB/s | 408 MB/s |
5253
| zstd 15 | 3.01 | 11 MB/s | 354 MB/s |
54+
55+
56+
## SquashFS
57+
58+
* The patch is located in `squashfs.diff`
59+
* Additionally `fs/squashfs/zstd_wrapper.c` is provided as a source for convenience.
60+
* The patch has been tested on a 4.10 kernel.
61+
62+
### Benchmarks
63+
64+
Benchmarks run on a Ubuntu 14.04 with 2 cores and 4 GiB of RAM.
65+
The VM is running on a Macbook Pro with a 3.1 GHz Intel Core i7 processor,
66+
16 GB of ram, and a SSD.
67+
The kernel running was built from the master branch with the patch (version 4.10).
68+
69+
The compression benchmark is the file tree from the SquashFS archive found in the
70+
Ubuntu 16.10 desktop image (ubuntu-16.10-desktop-amd64.iso).
71+
The compression benchmark uses mksquashfs with the default block size (128 KB)
72+
and various compression algorithms/compression levels.
73+
`xz` and `zstd` are also benchmarked with 256 KB blocks.
74+
The decompression benchmark is timing how long it takes to `tar` the file tree
75+
into `/dev/null`.
76+
See `squashfs-benchmark.sh` for details.
77+
78+
| Algorithm | Compression ratio | Compression speed | Decompression speed |
79+
|----------------|-------------------|-------------------|---------------------|
80+
| gzip | 2.92 | 15 MB/s | 128 MB/s |
81+
| lzo | 2.64 | 9.5 MB/s | 217 MB/s |
82+
| lz4 | 2.12 | 94 MB/s | 218 MB/s |
83+
| xz | 3.43 | 5.5 MB/s | 35 MB/s |
84+
| xz 256 KB | 3.53 | 5.4 MB/s | 40 MB/s |
85+
| zstd 1 | 2.71 | 96 MB/s | 210 MB/s |
86+
| zstd 5 | 2.93 | 69 MB/s | 198 MB/s |
87+
| zstd 10 | 3.01 | 41 MB/s | 225 MB/s |
88+
| zstd 15 | 3.13 | 11.4 MB/s | 224 MB/s |
89+
| zstd 16 256 KB | 3.24 | 8.1 MB/s | 210 MB/s |
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# !/bin/sh
2+
set -e
3+
4+
# Benchmarks run on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
5+
# The VM is running on a Macbook Pro with a 3.1 GHz Intel Core i7 processor and
6+
# 16 GB of RAM and an SSD.
7+
8+
# $BENCHMARK_DIR is generated with the following commands, from the Ubuntu image
9+
# ubuntu-16.10-desktop-amd64.iso.
10+
# > mkdir mnt
11+
# > sudo mount -o loop ubuntu-16.10-desktop-amd64.iso mnt
12+
# > cp mnt/casper/filesystem.squashfs .
13+
# > sudo unsquashfs filesystem.squashfs
14+
15+
# $HOME is on a ext4 filesystem
16+
BENCHMARK_DIR="$HOME/squashfs-root/"
17+
BENCHMARK_FS="$HOME/filesystem.squashfs"
18+
19+
# Normalize the environment
20+
sudo rm -f $BENCHMARK_FS 2> /dev/null > /dev/null || true
21+
sudo umount /mnt/squashfs 2> /dev/null > /dev/null || true
22+
23+
# Run the benchmark
24+
echo "Compression"
25+
echo "sudo mksquashfs $BENCHMARK_DIR $BENCHMARK_FS $@"
26+
time sudo mksquashfs $BENCHMARK_DIR $BENCHMARK_FS $@ 2> /dev/null > /dev/null
27+
28+
echo "Approximate compression ratio"
29+
printf "%d / %d\n" \
30+
$(sudo du -sx --block-size=1 $BENCHMARK_DIR | cut -f1) \
31+
$(sudo du -sx --block-size=1 $BENCHMARK_FS | cut -f1);
32+
33+
# Mount the filesystem
34+
sudo mount -t squashfs $BENCHMARK_FS /mnt/squashfs
35+
36+
echo "Decompression"
37+
time sudo tar -c /mnt/squashfs 2> /dev/null | wc -c > /dev/null
38+
39+
sudo umount /mnt/squashfs

0 commit comments

Comments
 (0)