Skip to content

Commit ac3f540

Browse files
raphaelscPekka Enberg
authored and
Pekka Enberg
committed
zfs: Port lz4 compression algorithm from FreeBSD
OSv port details: - Discarded manpage changes. - lz4 license was added to the licenses directory. - Addressed some conflicts in zfs/zfs_ioctl.c. - Add unused attributed to a few functions in zfs/lz4.c which are actually unused. * Illumos zfs issue #3035 [1] LZ4 compression support in ZFS. LZ4 is a new high-speed BSD-licensed compression algorithm created by Yann Collet that delivers very high compression and decompression performance compared to lzjb (>50% faster on compression, >80% faster on decompression and around 3x faster on compression of incompressible data), while giving better compression ratio [1]. FreeBSD commit hash: c6d9dc1 Signed-off-by: Raphael S. Carvalho <[email protected]> Signed-off-by: Pekka Enberg <[email protected]>
1 parent 28ff5b2 commit ac3f540

File tree

11 files changed

+1235
-2
lines changed

11 files changed

+1235
-2
lines changed

bsd/sys/cddl/compat/opensolaris/sys/byteorder.h

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
#ifndef _OPENSOLARIS_SYS_BYTEORDER_H_
4343
#define _OPENSOLARIS_SYS_BYTEORDER_H_
4444

45+
/* for htonl() */
46+
#ifndef _KERNEL
47+
#include <netinet/in.h>
48+
#endif
49+
4550
#include <endian.h>
4651

4752
#define _BIG_ENDIAN __BIG_ENDIAN
@@ -93,4 +98,6 @@
9398
#define ntohll(x) BSWAP_64(x)
9499
#endif
95100

101+
#define BE_IN32(xa) htonl(*((uint32_t *)(void *)(xa)))
102+
96103
#endif /* _OPENSOLARIS_SYS_BYTEORDER_H_ */

bsd/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
/*
2323
* Copyright (c) 2012 by Delphix. All rights reserved.
24+
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
2425
*/
2526

2627
#ifdef _KERNEL
@@ -155,4 +156,7 @@ zpool_feature_init(void)
155156
zfeature_register(SPA_FEATURE_EMPTY_BPOBJ,
156157
"com.delphix:empty_bpobj", "empty_bpobj",
157158
"Snapshots use less space.", B_TRUE, B_FALSE, NULL);
159+
zfeature_register(SPA_FEATURE_LZ4_COMPRESS,
160+
"org.illumos:lz4_compress", "lz4_compress",
161+
"LZ4 compression algorithm support.", B_FALSE, B_FALSE, NULL);
158162
}

bsd/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
/*
2323
* Copyright (c) 2012 by Delphix. All rights reserved.
24+
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
2425
*/
2526

2627
#ifndef _ZFEATURE_COMMON_H
@@ -51,6 +52,7 @@ typedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
5152
static enum spa_feature {
5253
SPA_FEATURE_ASYNC_DESTROY,
5354
SPA_FEATURE_EMPTY_BPOBJ,
55+
SPA_FEATURE_LZ4_COMPRESS,
5456
SPA_FEATURES
5557
} spa_feature_t;
5658

bsd/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
/*
2222
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
2323
* Copyright (c) 2011 by Delphix. All rights reserved.
24+
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
2425
*/
2526

2627
/* Portions Copyright 2010 Robert Milkowski */
@@ -96,6 +97,7 @@ zfs_prop_init(void)
9697
{ "gzip-8", ZIO_COMPRESS_GZIP_8 },
9798
{ "gzip-9", ZIO_COMPRESS_GZIP_9 },
9899
{ "zle", ZIO_COMPRESS_ZLE },
100+
{ "lz4", ZIO_COMPRESS_LZ4 },
99101
{ NULL }
100102
};
101103

@@ -211,8 +213,8 @@ zfs_prop_init(void)
211213
zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
212214
ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
213215
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
214-
"on | off | lzjb | gzip | gzip-[1-9] | zle", "COMPRESS",
215-
compress_table);
216+
"on | off | lzjb | gzip | gzip-[1-9] | zle | lz4",
217+
"COMPRESS", compress_table);
216218
zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN,
217219
PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
218220
"hidden | visible", "SNAPDIR", snapdir_table);

0 commit comments

Comments
 (0)