btrfs: lz4/lz4hc compression
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | btrfs: lz4: import lz4/lz4hc C and header filesfs/ fs/ fs/ +1 more | +1714 | 0 replies | |
| 2/5 | btrfs: lz4: add incompat flags and compression typesfs/ fs/ fs/ +1 more | +42 | 0 replies | |
| 2/5 | btrfs: lz4: add incompat flags and compression typesfs/ fs/ fs/ +1 more | +42 | 0 replies | |
| 3/5 | btrfs: lz4: add lz4_wrapper implementing btrfs compression interfacefs/ | +419 | 0 replies | |
| 4/5 | btrfs: lz4: add lz4 files in Makefilefs/ | +1 | 0 replies | |
| 5/5 | btrfs: enable lz4/lz4hc compressionfs/ fs/ fs/ | +4 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/5] btrfs: lz4/lz4hc compression
WARNING: This is not compatible with the previous lz4 patchset. If you're using experimental compression that isn't in mainline kernels, be prepared to backup and restore or decompress before upgrading, and have backups in case it eats data (which appears not to be a problem any more, but has been during development).
These patches add lz4 and lz4hc compression (https://code.google.com/p/lz4/) to btrfs. Compression with lz4 is about the same in throughput and compression ratio as lzo, but decompression is a good deal faster. In practice, this implementation also compresses faster and better than lzo because the existing lzo implementation breaks extents into pages that are compressed individually. The lz4hc compressor is a slower, higher-compression variation that is doesn't quite match zlib on compression throughput or ratio, but is much faster at decompression.
Some quick benchmarks, writing and reading a tarball of the Silesia corpus
(http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia) in a VM on a tmpfs-backed device. Times are in milliseconds.
method write read size
none 489 356 202.27MB
lzo 1618 632 115.62MB zlib 6583 1370 76.07MB lz4 1216 368 102.15MB lz4hc 8372 337 81.38MB
And with linux kernel sources (data size is btrfs fi df data size, may be underestimated due to inline extents).
method write read size none 8255 9880 446.11MB lzo 11867 9011 225.36MB zlib 20340 10419 154.22MB lz4 10642 8417 203.70MB lz4hc 20270 8280 171.68MB
A large portion of the work was done by Dave Sterba, but in flattening the commits attribution has been lost. My contribution has been in debugging some of the cases in which it could crash or produce incorrect data, and cleaning it up for the ML.
Andrew Mahone (5):
btrfs: lz4: import lz4/lz4hc C and header files
btrfs: lz4: add incompat flags and compression types
btrfs: lz4: add lz4_wrapper implementing btrfs compression interface
btrfs: lz4: add lz4 files in Makefile
btrfs: enable lz4/lz4hc compression
fs/btrfs/Makefile | 2 +- fs/btrfs/compression.c | 2 + fs/btrfs/compression.h | 2 + fs/btrfs/ctree.h | 16 +- fs/btrfs/disk-io.c | 4 + fs/btrfs/ioctl.c | 5 + fs/btrfs/lz4.c | 843 +++++++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/lz4.h | 128 ++++++++ fs/btrfs/lz4_wrapper.c | 419 ++++++++++++++++++++++++ fs/btrfs/lz4hc.c | 685 ++++++++++++++++++++++++++++++++++++++++ fs/btrfs/lz4hc.h | 58 ++++ fs/btrfs/super.c | 16 +- 12 files changed, 2174 insertions(+), 6 deletions(-) create mode 100644 fs/btrfs/lz4.c create mode 100644 fs/btrfs/lz4.h create mode 100644 fs/btrfs/lz4_wrapper.c create mode 100644 fs/btrfs/lz4hc.c create mode 100644 fs/btrfs/lz4hc.h
Signature · 1 line
1.7.11