]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Add lzo compression support
authorLi Zefan <lizf@cn.fujitsu.com>
Mon, 25 Oct 2010 07:12:26 +0000 (15:12 +0800)
committerLi Zefan <lizf@cn.fujitsu.com>
Wed, 22 Dec 2010 15:15:47 +0000 (23:15 +0800)
commitd1090ddcc2b004ba890b53c20f1c15000e5086b2
tree6cda8aa6a60967206614a941f034249e3017913e
parent97c0e3a6c1df8b2ae172596ad7783a528e176bcd
btrfs: Add lzo compression support

Lzo is a much faster compression algorithm than gzib, so would allow
more users to enable transparent compression, and some users can
choose from compression ratio and speed for different applications

Usage:

 # mount -t btrfs -o compress[=<zlib,lzo>] dev /mnt
or
 # mount -t btrfs -o compress-force[=<zlib,lzo>] dev /mnt

"-o compress" without argument is still allowed for compatability.

Compatibility:

If we mount a filesystem with lzo compression, it will not be able be
mounted in old kernels. One reason is, otherwise btrfs will directly
dump compressed data, which sits in inline extent, to user.

Performance:

The test copied a linux source tarball (~400M) from an ext4 partition
to the btrfs partition, and then extracted it.

(time in second)
           lzo        zlib        nocompress
copy:      10.6       21.7        14.9
extract:   70.1       94.4        66.6

(data size in MB)
           lzo        zlib        nocompress
copy:      185.87     108.69      394.49
extract:   193.80     132.36      381.21

Changelog:

v1 -> v2:
- Select LZO_COMPRESS and LZO_DECOMPRESS in btrfs Kconfig.
- Add incompability flag.
- Fix error handling in compress code.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
fs/btrfs/Kconfig
fs/btrfs/Makefile
fs/btrfs/compression.c
fs/btrfs/compression.h
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/lzo.c [new file with mode: 0644]
fs/btrfs/super.c