diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2010-10-25 15:12:26 +0800 |
---|---|---|
committer | Li Zefan <lizf@cn.fujitsu.com> | 2010-12-22 23:15:47 +0800 |
commit | a6fa6fae40ec336c7df6155255ae64ebef43a8bc (patch) | |
tree | 6cda8aa6a60967206614a941f034249e3017913e /fs/btrfs/super.c | |
parent | 261507a02ccba9afda919852263b6bc1581ce1ef (diff) | |
download | kernel_samsung_tuna-a6fa6fae40ec336c7df6155255ae64ebef43a8bc.zip kernel_samsung_tuna-a6fa6fae40ec336c7df6155255ae64ebef43a8bc.tar.gz kernel_samsung_tuna-a6fa6fae40ec336c7df6155255ae64ebef43a8bc.tar.bz2 |
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>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f348f2b..a1a76b2 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -168,6 +168,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) strcmp(args[0].from, "zlib") == 0) { compress_type = "zlib"; info->compress_type = BTRFS_COMPRESS_ZLIB; + } else if (strcmp(args[0].from, "lzo") == 0) { + compress_type = "lzo"; + info->compress_type = BTRFS_COMPRESS_LZO; } else { ret = -EINVAL; goto out; |