aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-10-25 03:12:26 -0400
committerLi Zefan <lizf@cn.fujitsu.com>2010-12-22 10:15:47 -0500
commita6fa6fae40ec336c7df6155255ae64ebef43a8bc (patch)
tree6cda8aa6a60967206614a941f034249e3017913e /fs/btrfs/ctree.h
parent261507a02ccba9afda919852263b6bc1581ce1ef (diff)
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/ctree.h')
-rw-r--r--fs/btrfs/ctree.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index e06534438592..53b984623983 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -398,13 +398,15 @@ struct btrfs_super_block {
398#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) 398#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)
399#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) 399#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
400#define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) 400#define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2)
401#define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3)
401 402
402#define BTRFS_FEATURE_COMPAT_SUPP 0ULL 403#define BTRFS_FEATURE_COMPAT_SUPP 0ULL
403#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL 404#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL
404#define BTRFS_FEATURE_INCOMPAT_SUPP \ 405#define BTRFS_FEATURE_INCOMPAT_SUPP \
405 (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \ 406 (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \
406 BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL | \ 407 BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL | \
407 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) 408 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS | \
409 BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO)
408 410
409/* 411/*
410 * A leaf is full of items. offset and size tell us where to find 412 * A leaf is full of items. offset and size tell us where to find
@@ -553,8 +555,9 @@ struct btrfs_timespec {
553enum btrfs_compression_type { 555enum btrfs_compression_type {
554 BTRFS_COMPRESS_NONE = 0, 556 BTRFS_COMPRESS_NONE = 0,
555 BTRFS_COMPRESS_ZLIB = 1, 557 BTRFS_COMPRESS_ZLIB = 1,
556 BTRFS_COMPRESS_TYPES = 1, 558 BTRFS_COMPRESS_LZO = 2,
557 BTRFS_COMPRESS_LAST = 2, 559 BTRFS_COMPRESS_TYPES = 2,
560 BTRFS_COMPRESS_LAST = 3,
558}; 561};
559 562
560struct btrfs_inode_item { 563struct btrfs_inode_item {