aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys
diff options
context:
space:
mode:
authorEric Dillmann <[email protected]>2013-01-23 10:54:30 +0100
committerBrian Behlendorf <[email protected]>2013-01-29 09:28:20 -0800
commit9759c60f1a1503e48dc5c45a209c3edd5758319f (patch)
treead56536c5e57c831f38f4b0df81f816470f28c1c /include/sys
parentff5b1c8065c8a43add534892172f0aa5aba90f3d (diff)
Illumos #3035 LZ4 compression support in ZFS and GRUB
3035 LZ4 compression support in ZFS and GRUB Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Christopher Siden <[email protected]> References: illumos/illumos-gate@a6f561b4aee75d0d028e7b36b151c8ed8a86bc76 https://www.illumos.org/issues/3035 http://wiki.illumos.org/display/illumos/LZ4+Compression+In+ZFS This patch has been slightly modified from the upstream Illumos version to be compatible with Linux. Due to the very limited stack space in the kernel a lz4 workspace kmem cache is used. Since we are using gcc we are also able to take advantage of the gcc optimized __builtin_ctz functions. Support for GRUB has been dropped from this patch. That code is available but those changes will need to made to the upstream GRUB package. Lastly, several hunks of dead code were dropped for clarity. They include the functions real_LZ4_uncompress(), LZ4_compressBound() and the Visual Studio specific hunks wrapped in _MSC_VER. Ported-by: Eric Dillmann <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1217
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/zio.h3
-rw-r--r--include/sys/zio_compress.h10
2 files changed, 13 insertions, 0 deletions
diff --git a/include/sys/zio.h b/include/sys/zio.h
index 052797928..64efde016 100644
--- a/include/sys/zio.h
+++ b/include/sys/zio.h
@@ -25,6 +25,7 @@
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
*/
#ifndef _ZIO_H
@@ -108,6 +109,7 @@ enum zio_compress {
ZIO_COMPRESS_GZIP_8,
ZIO_COMPRESS_GZIP_9,
ZIO_COMPRESS_ZLE,
+ ZIO_COMPRESS_LZ4,
ZIO_COMPRESS_FUNCTIONS
};
@@ -116,6 +118,7 @@ enum zio_compress {
#define BOOTFS_COMPRESS_VALID(compress) \
((compress) == ZIO_COMPRESS_LZJB || \
+ (compress) == ZIO_COMPRESS_LZ4 || \
((compress) == ZIO_COMPRESS_ON && \
ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \
(compress) == ZIO_COMPRESS_OFF)
diff --git a/include/sys/zio_compress.h b/include/sys/zio_compress.h
index 30bed1a67..49946af4b 100644
--- a/include/sys/zio_compress.h
+++ b/include/sys/zio_compress.h
@@ -54,6 +54,12 @@ typedef struct zio_compress_info {
extern zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS];
/*
+ * lz4 compression init & free
+ */
+extern void lz4_init(void);
+extern void lz4_fini(void);
+
+/*
* Compression routines.
*/
extern size_t lzjb_compress(void *src, void *dst, size_t s_len, size_t d_len,
@@ -68,6 +74,10 @@ extern size_t zle_compress(void *src, void *dst, size_t s_len, size_t d_len,
int level);
extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len,
int level);
+extern size_t lz4_compress(void *src, void *dst, size_t s_len, size_t d_len,
+ int level);
+extern int lz4_decompress(void *src, void *dst, size_t s_len, size_t d_len,
+ int level);
/*
* Compress and decompress data if necessary.