MFV r245512:
* 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]. This version of LZ4 corresponds to upstream's [2] revision 85. Please note that for obvious reasons this is not backward read compatible. This means once a pool have LZ4 compressed data, these data can no longer be read by older ZFS implementations. Local changes: - On-stack hash table disabled and using kernel slab allocator instead, at this time. This requires larger kernel thread stack for zio workers. This may change in the future should we adjusted the zio workers' thread stack size. - likely and unlikely will be undefined if they are already defined, this is required for i386 XEN build. - Removed De Bruijn sequence based __builtin_ctz family of builtins in favor of the latter. Both GCC and clang supports these builtins. - Changed the way the LZ4 code detects endianness. - Manual pages modifications to mention the feature based on Illumos counterpart. - Boot loader changes to make it support LZ4 decompression. [1] https://www.illumos.org/issues/3035 [2] http://code.google.com/p/lz4/source/list Obtained from: Illumos (13921:9d721847e469) Tested on: FreeBSD/amd64 MFC after: 1 month
This commit is contained in:
commit
ef17620fc8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=246586
@ -24,10 +24,11 @@
|
|||||||
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||||
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
|
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
|
||||||
.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
|
.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
|
||||||
|
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd November 26, 2012
|
.Dd February 8, 2012
|
||||||
.Dt ZFS 8
|
.Dt ZFS 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -866,7 +867,7 @@ but this may change in future releases). The value
|
|||||||
disables integrity checking on user data. Disabling checksums is
|
disables integrity checking on user data. Disabling checksums is
|
||||||
.Em NOT
|
.Em NOT
|
||||||
a recommended practice.
|
a recommended practice.
|
||||||
.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle
|
.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | zle | Cm lz4
|
||||||
Controls the compression algorithm used for this dataset. The
|
Controls the compression algorithm used for this dataset. The
|
||||||
.Cm lzjb
|
.Cm lzjb
|
||||||
compression algorithm is optimized for performance while providing decent data
|
compression algorithm is optimized for performance while providing decent data
|
||||||
@ -894,6 +895,26 @@ The
|
|||||||
.Cm zle
|
.Cm zle
|
||||||
compression algorithm compresses runs of zeros.
|
compression algorithm compresses runs of zeros.
|
||||||
.Pp
|
.Pp
|
||||||
|
The
|
||||||
|
.Sy lz4
|
||||||
|
compression algorithm is a high-performance replacement
|
||||||
|
for the
|
||||||
|
.Sy lzjb
|
||||||
|
algorithm. It features significantly faster
|
||||||
|
compression and decompression, as well as a moderately higher
|
||||||
|
compression ratio than
|
||||||
|
.Sy lzjb ,
|
||||||
|
but can only be used on pools with
|
||||||
|
the
|
||||||
|
.Sy lz4_compress
|
||||||
|
feature set to
|
||||||
|
.Sy enabled .
|
||||||
|
See
|
||||||
|
.Xr zpool-features 7
|
||||||
|
for details on ZFS feature flags and the
|
||||||
|
.Sy lz4_compress
|
||||||
|
feature.
|
||||||
|
.Pp
|
||||||
This property can also be referred to by its shortened column name
|
This property can also be referred to by its shortened column name
|
||||||
.Cm compress .
|
.Cm compress .
|
||||||
Changing this property affects only newly-written data.
|
Changing this property affects only newly-written data.
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
.\" information: Portions Copyright [yyyy] [name of copyright owner]
|
.\" information: Portions Copyright [yyyy] [name of copyright owner]
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 2012 by Delphix. All rights reserved.
|
.\" Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
|
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd Aug 28, 2012
|
.Dd February 8, 2012
|
||||||
.Dt ZPOOL-FEATURES 7
|
.Dt ZPOOL-FEATURES 7
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -185,6 +186,49 @@ This feature is
|
|||||||
.Sy active
|
.Sy active
|
||||||
while there are any filesystems, volumes, or snapshots which were created
|
while there are any filesystems, volumes, or snapshots which were created
|
||||||
after enabling this feature.
|
after enabling this feature.
|
||||||
|
.It Sy lz4_compress
|
||||||
|
.Bl -column "READ\-ONLY COMPATIBLE" "org.illumos:lz4_compress"
|
||||||
|
.It GUID Ta org.illumos:lz4_compress
|
||||||
|
.It READ\-ONLY COMPATIBLE Ta no
|
||||||
|
.It DEPENDENCIES Ta none
|
||||||
|
.El
|
||||||
|
.Pp
|
||||||
|
.Sy lz4
|
||||||
|
is a high-performance real-time compression algorithm that
|
||||||
|
features significantly faster compression and decompression as well as a
|
||||||
|
higher compression ratio than the older
|
||||||
|
.Sy lzjb
|
||||||
|
compression.
|
||||||
|
Typically,
|
||||||
|
.Sy lz4
|
||||||
|
compression is approximately 50% faster on
|
||||||
|
compressible data and 200% faster on incompressible data than
|
||||||
|
.Sy lzjb .
|
||||||
|
It is also approximately 80% faster on decompression, while
|
||||||
|
giving approximately 10% better compression ratio.
|
||||||
|
.Pp
|
||||||
|
When the
|
||||||
|
.Sy lz4_compress
|
||||||
|
feature is set to
|
||||||
|
.Sy enabled ,
|
||||||
|
the
|
||||||
|
administrator can turn on
|
||||||
|
.Sy lz4
|
||||||
|
compression on any dataset on the
|
||||||
|
pool using the
|
||||||
|
.Xr zfs 8
|
||||||
|
command. Please note that doing so will
|
||||||
|
immediately activate the
|
||||||
|
.Sy lz4_compress
|
||||||
|
feature on the underlying
|
||||||
|
pool (even before any data is written). Since this feature is not
|
||||||
|
read-only compatible, this operation will render the pool unimportable
|
||||||
|
on systems without support for the
|
||||||
|
.Sy lz4_compress
|
||||||
|
feature. At the
|
||||||
|
moment, this operation cannot be reversed. Booting off of
|
||||||
|
.Sy lz4
|
||||||
|
-compressed root pools is supported.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr zpool 8
|
.Xr zpool 8
|
||||||
|
@ -5,6 +5,7 @@ are used by the ZFS bootstrap:
|
|||||||
|
|
||||||
fletcher.c checksum support
|
fletcher.c checksum support
|
||||||
sha256.c checksum support
|
sha256.c checksum support
|
||||||
|
lz4.c compression support
|
||||||
lzjb.c compression support
|
lzjb.c compression support
|
||||||
zfssubr.c checksum, compression and raidz support
|
zfssubr.c checksum, compression and raidz support
|
||||||
zfsimpl.h mostly describing the physical layout
|
zfsimpl.h mostly describing the physical layout
|
||||||
|
308
sys/cddl/boot/zfs/lz4.c
Normal file
308
sys/cddl/boot/zfs/lz4.c
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
/*
|
||||||
|
* LZ4 - Fast LZ compression algorithm
|
||||||
|
* Header File
|
||||||
|
* Copyright (C) 2011-2013, Yann Collet.
|
||||||
|
* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following disclaimer
|
||||||
|
* in the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* You can contact the author at :
|
||||||
|
* - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
|
||||||
|
* - LZ4 source repository : http://code.google.com/p/lz4/
|
||||||
|
*
|
||||||
|
* $FreeBSD$
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
|
||||||
|
int isize, int maxOutputSize);
|
||||||
|
|
||||||
|
/* ARGSUSED */
|
||||||
|
static int
|
||||||
|
lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int dummy __unused)
|
||||||
|
{
|
||||||
|
const uint8_t *src = s_start;
|
||||||
|
uint32_t bufsiz = htonl(*(uint32_t *)src);
|
||||||
|
|
||||||
|
/* invalid compressed buffer size encoded at start */
|
||||||
|
if (bufsiz + 4 > s_len)
|
||||||
|
return (1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns 0 on success (decompression function returned non-negative)
|
||||||
|
* and non-zero on failure (decompression function returned negative).
|
||||||
|
*/
|
||||||
|
return (LZ4_uncompress_unknownOutputSize(s_start + 4, d_start, bufsiz,
|
||||||
|
d_len) < 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CPU Feature Detection
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 32 or 64 bits ? */
|
||||||
|
#if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || \
|
||||||
|
defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || \
|
||||||
|
defined(__LP64__) || defined(_LP64))
|
||||||
|
#define LZ4_ARCH64 1
|
||||||
|
#else
|
||||||
|
#define LZ4_ARCH64 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Little Endian or Big Endian?
|
||||||
|
* Note: overwrite the below #define if you know your architecture endianess.
|
||||||
|
*/
|
||||||
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
|
#define LZ4_BIG_ENDIAN 1
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Little Endian assumed. PDP Endian and other very rare endian format
|
||||||
|
* are unsupported.
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compiler Options
|
||||||
|
*/
|
||||||
|
#if __STDC_VERSION__ >= 199901L /* C99 */
|
||||||
|
/* "restrict" is a known keyword */
|
||||||
|
#else
|
||||||
|
/* Disable restrict */
|
||||||
|
#define restrict
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||||
|
|
||||||
|
#define lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) \
|
||||||
|
| (((x) & 0xffu) << 8)))
|
||||||
|
|
||||||
|
#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__)
|
||||||
|
#define expect(expr, value) (__builtin_expect((expr), (value)))
|
||||||
|
#else
|
||||||
|
#define expect(expr, value) (expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define likely(expr) expect((expr) != 0, 1)
|
||||||
|
#define unlikely(expr) expect((expr) != 0, 0)
|
||||||
|
|
||||||
|
/* Basic types */
|
||||||
|
#define BYTE uint8_t
|
||||||
|
#define U16 uint16_t
|
||||||
|
#define U32 uint32_t
|
||||||
|
#define S32 int32_t
|
||||||
|
#define U64 uint64_t
|
||||||
|
|
||||||
|
typedef struct _U16_S {
|
||||||
|
U16 v;
|
||||||
|
} U16_S;
|
||||||
|
typedef struct _U32_S {
|
||||||
|
U32 v;
|
||||||
|
} U32_S;
|
||||||
|
typedef struct _U64_S {
|
||||||
|
U64 v;
|
||||||
|
} U64_S;
|
||||||
|
|
||||||
|
#define A64(x) (((U64_S *)(x))->v)
|
||||||
|
#define A32(x) (((U32_S *)(x))->v)
|
||||||
|
#define A16(x) (((U16_S *)(x))->v)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
#define MINMATCH 4
|
||||||
|
|
||||||
|
#define COPYLENGTH 8
|
||||||
|
#define LASTLITERALS 5
|
||||||
|
|
||||||
|
#define ML_BITS 4
|
||||||
|
#define ML_MASK ((1U<<ML_BITS)-1)
|
||||||
|
#define RUN_BITS (8-ML_BITS)
|
||||||
|
#define RUN_MASK ((1U<<RUN_BITS)-1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Architecture-specific macros
|
||||||
|
*/
|
||||||
|
#if LZ4_ARCH64
|
||||||
|
#define STEPSIZE 8
|
||||||
|
#define UARCH U64
|
||||||
|
#define AARCH A64
|
||||||
|
#define LZ4_COPYSTEP(s, d) A64(d) = A64(s); d += 8; s += 8;
|
||||||
|
#define LZ4_COPYPACKET(s, d) LZ4_COPYSTEP(s, d)
|
||||||
|
#define LZ4_SECURECOPY(s, d, e) if (d < e) LZ4_WILDCOPY(s, d, e)
|
||||||
|
#define HTYPE U32
|
||||||
|
#define INITBASE(base) const BYTE* const base = ip
|
||||||
|
#else
|
||||||
|
#define STEPSIZE 4
|
||||||
|
#define UARCH U32
|
||||||
|
#define AARCH A32
|
||||||
|
#define LZ4_COPYSTEP(s, d) A32(d) = A32(s); d += 4; s += 4;
|
||||||
|
#define LZ4_COPYPACKET(s, d) LZ4_COPYSTEP(s, d); LZ4_COPYSTEP(s, d);
|
||||||
|
#define LZ4_SECURECOPY LZ4_WILDCOPY
|
||||||
|
#define HTYPE const BYTE*
|
||||||
|
#define INITBASE(base) const int base = 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined(LZ4_BIG_ENDIAN) && !defined(BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE))
|
||||||
|
#define LZ4_READ_LITTLEENDIAN_16(d, s, p) \
|
||||||
|
{ U16 v = A16(p); v = lz4_bswap16(v); d = (s) - v; }
|
||||||
|
#define LZ4_WRITE_LITTLEENDIAN_16(p, i) \
|
||||||
|
{ U16 v = (U16)(i); v = lz4_bswap16(v); A16(p) = v; p += 2; }
|
||||||
|
#else
|
||||||
|
#define LZ4_READ_LITTLEENDIAN_16(d, s, p) { d = (s) - A16(p); }
|
||||||
|
#define LZ4_WRITE_LITTLEENDIAN_16(p, v) { A16(p) = v; p += 2; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Macros */
|
||||||
|
#define LZ4_WILDCOPY(s, d, e) do { LZ4_COPYPACKET(s, d) } while (d < e);
|
||||||
|
|
||||||
|
/* Decompression functions */
|
||||||
|
|
||||||
|
static int
|
||||||
|
LZ4_uncompress_unknownOutputSize(const char *source,
|
||||||
|
char *dest, int isize, int maxOutputSize)
|
||||||
|
{
|
||||||
|
/* Local Variables */
|
||||||
|
const BYTE *restrict ip = (const BYTE *) source;
|
||||||
|
const BYTE *const iend = ip + isize;
|
||||||
|
const BYTE *restrict ref;
|
||||||
|
|
||||||
|
BYTE *restrict op = (BYTE *) dest;
|
||||||
|
BYTE *const oend = op + maxOutputSize;
|
||||||
|
BYTE *cpy;
|
||||||
|
|
||||||
|
size_t dec[] = { 0, 3, 2, 3, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
/* Main Loop */
|
||||||
|
while (ip < iend) {
|
||||||
|
BYTE token;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
/* get runlength */
|
||||||
|
token = *ip++;
|
||||||
|
if ((length = (token >> ML_BITS)) == RUN_MASK) {
|
||||||
|
int s = 255;
|
||||||
|
while ((ip < iend) && (s == 255)) {
|
||||||
|
s = *ip++;
|
||||||
|
length += s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* copy literals */
|
||||||
|
cpy = op + length;
|
||||||
|
if ((cpy > oend - COPYLENGTH) ||
|
||||||
|
(ip + length > iend - COPYLENGTH)) {
|
||||||
|
if (cpy > oend)
|
||||||
|
/*
|
||||||
|
* Error: request to write beyond destination
|
||||||
|
* buffer.
|
||||||
|
*/
|
||||||
|
goto _output_error;
|
||||||
|
if (ip + length > iend)
|
||||||
|
/*
|
||||||
|
* Error : request to read beyond source
|
||||||
|
* buffer.
|
||||||
|
*/
|
||||||
|
goto _output_error;
|
||||||
|
memcpy(op, ip, length);
|
||||||
|
op += length;
|
||||||
|
ip += length;
|
||||||
|
if (ip < iend)
|
||||||
|
/* Error : LZ4 format violation */
|
||||||
|
goto _output_error;
|
||||||
|
/* Necessarily EOF, due to parsing restrictions. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
LZ4_WILDCOPY(ip, op, cpy);
|
||||||
|
ip -= (op - cpy);
|
||||||
|
op = cpy;
|
||||||
|
|
||||||
|
/* get offset */
|
||||||
|
LZ4_READ_LITTLEENDIAN_16(ref, cpy, ip);
|
||||||
|
ip += 2;
|
||||||
|
if (ref < (BYTE * const) dest)
|
||||||
|
/*
|
||||||
|
* Error: offset creates reference outside of
|
||||||
|
* destination buffer.
|
||||||
|
*/
|
||||||
|
goto _output_error;
|
||||||
|
|
||||||
|
/* get matchlength */
|
||||||
|
if ((length = (token & ML_MASK)) == ML_MASK) {
|
||||||
|
while (ip < iend) {
|
||||||
|
int s = *ip++;
|
||||||
|
length += s;
|
||||||
|
if (s == 255)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* copy repeated sequence */
|
||||||
|
if unlikely(op - ref < STEPSIZE) {
|
||||||
|
#if LZ4_ARCH64
|
||||||
|
size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 };
|
||||||
|
size_t dec2 = dec2table[op - ref];
|
||||||
|
#else
|
||||||
|
const int dec2 = 0;
|
||||||
|
#endif
|
||||||
|
*op++ = *ref++;
|
||||||
|
*op++ = *ref++;
|
||||||
|
*op++ = *ref++;
|
||||||
|
*op++ = *ref++;
|
||||||
|
ref -= dec[op - ref];
|
||||||
|
A32(op) = A32(ref);
|
||||||
|
op += STEPSIZE - 4;
|
||||||
|
ref -= dec2;
|
||||||
|
} else {
|
||||||
|
LZ4_COPYSTEP(ref, op);
|
||||||
|
}
|
||||||
|
cpy = op + length - (STEPSIZE - 4);
|
||||||
|
if (cpy > oend - COPYLENGTH) {
|
||||||
|
if (cpy > oend)
|
||||||
|
/*
|
||||||
|
* Error: request to write outside of
|
||||||
|
* destination buffer.
|
||||||
|
*/
|
||||||
|
goto _output_error;
|
||||||
|
LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
|
||||||
|
while (op < cpy)
|
||||||
|
*op++ = *ref++;
|
||||||
|
op = cpy;
|
||||||
|
if (op == oend)
|
||||||
|
/*
|
||||||
|
* Check EOF (should never happen, since last
|
||||||
|
* 5 bytes are supposed to be literals).
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LZ4_SECURECOPY(ref, op, cpy);
|
||||||
|
op = cpy; /* correction */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end of decoding */
|
||||||
|
return (int)(((char *)op) - dest);
|
||||||
|
|
||||||
|
/* write overflow error detected */
|
||||||
|
_output_error:
|
||||||
|
return (int)(-(((char *)ip) - source));
|
||||||
|
}
|
@ -52,6 +52,9 @@
|
|||||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright 2013 by Saso Kiselkov. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
#define MAXNAMELEN 256
|
#define MAXNAMELEN 256
|
||||||
|
|
||||||
@ -439,6 +442,7 @@ enum zio_compress {
|
|||||||
ZIO_COMPRESS_GZIP_8,
|
ZIO_COMPRESS_GZIP_8,
|
||||||
ZIO_COMPRESS_GZIP_9,
|
ZIO_COMPRESS_GZIP_9,
|
||||||
ZIO_COMPRESS_ZLE,
|
ZIO_COMPRESS_ZLE,
|
||||||
|
ZIO_COMPRESS_LZ4,
|
||||||
ZIO_COMPRESS_FUNCTIONS
|
ZIO_COMPRESS_FUNCTIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,6 +119,7 @@ typedef struct zio_compress_info {
|
|||||||
|
|
||||||
#include "lzjb.c"
|
#include "lzjb.c"
|
||||||
#include "zle.c"
|
#include "zle.c"
|
||||||
|
#include "lz4.c"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compression vectors.
|
* Compression vectors.
|
||||||
@ -139,6 +140,7 @@ static zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
|
|||||||
{NULL, NULL, 8, "gzip-8"},
|
{NULL, NULL, 8, "gzip-8"},
|
||||||
{NULL, NULL, 9, "gzip-9"},
|
{NULL, NULL, 9, "gzip-9"},
|
||||||
{NULL, zle_decompress, 64, "zle"},
|
{NULL, zle_decompress, 64, "zle"},
|
||||||
|
{NULL, lz4_decompress, 0, "lz4"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -42,6 +42,11 @@
|
|||||||
#ifndef _OPENSOLARIS_SYS_BYTEORDER_H_
|
#ifndef _OPENSOLARIS_SYS_BYTEORDER_H_
|
||||||
#define _OPENSOLARIS_SYS_BYTEORDER_H_
|
#define _OPENSOLARIS_SYS_BYTEORDER_H_
|
||||||
|
|
||||||
|
/* for htonl() */
|
||||||
|
#ifndef _KERNEL
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macros to reverse byte order
|
* Macros to reverse byte order
|
||||||
*/
|
*/
|
||||||
@ -86,4 +91,6 @@
|
|||||||
#define ntohll(x) BSWAP_64(x)
|
#define ntohll(x) BSWAP_64(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BE_IN32(xa) htonl(*((uint32_t *)(void *)(xa)))
|
||||||
|
|
||||||
#endif /* _OPENSOLARIS_SYS_BYTEORDER_H_ */
|
#endif /* _OPENSOLARIS_SYS_BYTEORDER_H_ */
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
|
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
@ -155,4 +156,7 @@ zpool_feature_init(void)
|
|||||||
zfeature_register(SPA_FEATURE_EMPTY_BPOBJ,
|
zfeature_register(SPA_FEATURE_EMPTY_BPOBJ,
|
||||||
"com.delphix:empty_bpobj", "empty_bpobj",
|
"com.delphix:empty_bpobj", "empty_bpobj",
|
||||||
"Snapshots use less space.", B_TRUE, B_FALSE, NULL);
|
"Snapshots use less space.", B_TRUE, B_FALSE, NULL);
|
||||||
|
zfeature_register(SPA_FEATURE_LZ4_COMPRESS,
|
||||||
|
"org.illumos:lz4_compress", "lz4_compress",
|
||||||
|
"LZ4 compression algorithm support.", B_FALSE, B_FALSE, NULL);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
|
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ZFEATURE_COMMON_H
|
#ifndef _ZFEATURE_COMMON_H
|
||||||
@ -51,6 +52,7 @@ typedef int (zfeature_func_t)(zfeature_info_t *fi, void *arg);
|
|||||||
static enum spa_feature {
|
static enum spa_feature {
|
||||||
SPA_FEATURE_ASYNC_DESTROY,
|
SPA_FEATURE_ASYNC_DESTROY,
|
||||||
SPA_FEATURE_EMPTY_BPOBJ,
|
SPA_FEATURE_EMPTY_BPOBJ,
|
||||||
|
SPA_FEATURE_LZ4_COMPRESS,
|
||||||
SPA_FEATURES
|
SPA_FEATURES
|
||||||
} spa_feature_t;
|
} spa_feature_t;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||||
|
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Portions Copyright 2010 Robert Milkowski */
|
/* Portions Copyright 2010 Robert Milkowski */
|
||||||
@ -96,6 +97,7 @@ zfs_prop_init(void)
|
|||||||
{ "gzip-8", ZIO_COMPRESS_GZIP_8 },
|
{ "gzip-8", ZIO_COMPRESS_GZIP_8 },
|
||||||
{ "gzip-9", ZIO_COMPRESS_GZIP_9 },
|
{ "gzip-9", ZIO_COMPRESS_GZIP_9 },
|
||||||
{ "zle", ZIO_COMPRESS_ZLE },
|
{ "zle", ZIO_COMPRESS_ZLE },
|
||||||
|
{ "lz4", ZIO_COMPRESS_LZ4 },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -211,8 +213,8 @@ zfs_prop_init(void)
|
|||||||
zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
|
zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
|
||||||
ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
|
ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
|
||||||
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
|
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
|
||||||
"on | off | lzjb | gzip | gzip-[1-9] | zle", "COMPRESS",
|
"on | off | lzjb | gzip | gzip-[1-9] | zle | lz4",
|
||||||
compress_table);
|
"COMPRESS", compress_table);
|
||||||
zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN,
|
zprop_register_index(ZFS_PROP_SNAPDIR, "snapdir", ZFS_SNAPDIR_HIDDEN,
|
||||||
PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
|
PROP_INHERIT, ZFS_TYPE_FILESYSTEM,
|
||||||
"hidden | visible", "SNAPDIR", snapdir_table);
|
"hidden | visible", "SNAPDIR", snapdir_table);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
# Copyright (c) 2012 by Delphix. All rights reserved.
|
# Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
|
# Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# This Makefile defines all file modules for the directory uts/common
|
# This Makefile defines all file modules for the directory uts/common
|
||||||
@ -56,6 +57,7 @@ ZFS_COMMON_OBJS += \
|
|||||||
dsl_scan.o \
|
dsl_scan.o \
|
||||||
zfeature.o \
|
zfeature.o \
|
||||||
gzip.o \
|
gzip.o \
|
||||||
|
lz4.o \
|
||||||
lzjb.o \
|
lzjb.o \
|
||||||
metaslab.o \
|
metaslab.o \
|
||||||
refcount.o \
|
refcount.o \
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
LZ4 - Fast LZ compression algorithm
|
||||||
|
Copyright (C) 2011-2013, Yann Collet.
|
||||||
|
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||||
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
You can contact the author at :
|
||||||
|
- LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
|
||||||
|
- LZ4 source repository : http://code.google.com/p/lz4/
|
@ -0,0 +1 @@
|
|||||||
|
LZ4 COMPRESSION FUNCTIONALITY IN ZFS
|
1064
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c
Normal file
1064
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
|
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ZIO_H
|
#ifndef _ZIO_H
|
||||||
@ -106,14 +107,17 @@ enum zio_compress {
|
|||||||
ZIO_COMPRESS_GZIP_8,
|
ZIO_COMPRESS_GZIP_8,
|
||||||
ZIO_COMPRESS_GZIP_9,
|
ZIO_COMPRESS_GZIP_9,
|
||||||
ZIO_COMPRESS_ZLE,
|
ZIO_COMPRESS_ZLE,
|
||||||
|
ZIO_COMPRESS_LZ4,
|
||||||
ZIO_COMPRESS_FUNCTIONS
|
ZIO_COMPRESS_FUNCTIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* N.B. when altering this value, also change BOOTFS_COMPRESS_VALID below */
|
||||||
#define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB
|
#define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB
|
||||||
#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
|
#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
|
||||||
|
|
||||||
#define BOOTFS_COMPRESS_VALID(compress) \
|
#define BOOTFS_COMPRESS_VALID(compress) \
|
||||||
((compress) == ZIO_COMPRESS_LZJB || \
|
((compress) == ZIO_COMPRESS_LZJB || \
|
||||||
|
(compress) == ZIO_COMPRESS_LZ4 || \
|
||||||
((compress) == ZIO_COMPRESS_ON && \
|
((compress) == ZIO_COMPRESS_ON && \
|
||||||
ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \
|
ZIO_COMPRESS_ON_VALUE == ZIO_COMPRESS_LZJB) || \
|
||||||
(compress) == ZIO_COMPRESS_OFF)
|
(compress) == ZIO_COMPRESS_OFF)
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _SYS_ZIO_COMPRESS_H
|
#ifndef _SYS_ZIO_COMPRESS_H
|
||||||
#define _SYS_ZIO_COMPRESS_H
|
#define _SYS_ZIO_COMPRESS_H
|
||||||
@ -68,6 +71,10 @@ extern size_t zle_compress(void *src, void *dst, size_t s_len, size_t d_len,
|
|||||||
int level);
|
int level);
|
||||||
extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len,
|
extern int zle_decompress(void *src, void *dst, size_t s_len, size_t d_len,
|
||||||
int level);
|
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.
|
* Compress and decompress data if necessary.
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -75,6 +76,7 @@
|
|||||||
#include <sys/zvol.h>
|
#include <sys/zvol.h>
|
||||||
#include <sys/dsl_scan.h>
|
#include <sys/dsl_scan.h>
|
||||||
#include <sys/dmu_objset.h>
|
#include <sys/dmu_objset.h>
|
||||||
|
#include <sys/zfeature.h>
|
||||||
|
|
||||||
#include "zfs_namecheck.h"
|
#include "zfs_namecheck.h"
|
||||||
#include "zfs_prop.h"
|
#include "zfs_prop.h"
|
||||||
@ -131,6 +133,12 @@ int zfs_set_prop_nvlist(const char *, zprop_source_t, nvlist_t *, nvlist_t **);
|
|||||||
|
|
||||||
static void zfsdev_close(void *data);
|
static void zfsdev_close(void *data);
|
||||||
|
|
||||||
|
static int zfs_prop_activate_feature(dsl_pool_t *dp, zfeature_info_t *feature);
|
||||||
|
static int zfs_prop_activate_feature_check(void *arg1, void *arg2,
|
||||||
|
dmu_tx_t *tx);
|
||||||
|
static void zfs_prop_activate_feature_sync(void *arg1, void *arg2,
|
||||||
|
dmu_tx_t *tx);
|
||||||
|
|
||||||
/* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */
|
/* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */
|
||||||
void
|
void
|
||||||
__dprintf(const char *file, const char *func, int line, const char *fmt, ...)
|
__dprintf(const char *file, const char *func, int line, const char *fmt, ...)
|
||||||
@ -2264,6 +2272,40 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ZFS_PROP_COMPRESSION:
|
||||||
|
{
|
||||||
|
if (intval == ZIO_COMPRESS_LZ4) {
|
||||||
|
zfeature_info_t *feature =
|
||||||
|
&spa_feature_table[SPA_FEATURE_LZ4_COMPRESS];
|
||||||
|
spa_t *spa;
|
||||||
|
dsl_pool_t *dp;
|
||||||
|
|
||||||
|
if ((err = spa_open(dsname, &spa, FTAG)) != 0)
|
||||||
|
return (err);
|
||||||
|
|
||||||
|
dp = spa->spa_dsl_pool;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setting the LZ4 compression algorithm activates
|
||||||
|
* the feature.
|
||||||
|
*/
|
||||||
|
if (!spa_feature_is_active(spa, feature)) {
|
||||||
|
if ((err = zfs_prop_activate_feature(dp,
|
||||||
|
feature)) != 0) {
|
||||||
|
spa_close(spa, FTAG);
|
||||||
|
return (err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spa_close(spa, FTAG);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* We still want the default set action to be performed in the
|
||||||
|
* caller, we only performed zfeature settings here.
|
||||||
|
*/
|
||||||
|
err = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
err = -1;
|
err = -1;
|
||||||
@ -3481,6 +3523,22 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
|
|||||||
SPA_VERSION_ZLE_COMPRESSION))
|
SPA_VERSION_ZLE_COMPRESSION))
|
||||||
return (ENOTSUP);
|
return (ENOTSUP);
|
||||||
|
|
||||||
|
if (intval == ZIO_COMPRESS_LZ4) {
|
||||||
|
zfeature_info_t *feature =
|
||||||
|
&spa_feature_table[
|
||||||
|
SPA_FEATURE_LZ4_COMPRESS];
|
||||||
|
spa_t *spa;
|
||||||
|
|
||||||
|
if ((err = spa_open(dsname, &spa, FTAG)) != 0)
|
||||||
|
return (err);
|
||||||
|
|
||||||
|
if (!spa_feature_is_enabled(spa, feature)) {
|
||||||
|
spa_close(spa, FTAG);
|
||||||
|
return (ENOTSUP);
|
||||||
|
}
|
||||||
|
spa_close(spa, FTAG);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is a bootable dataset then
|
* If this is a bootable dataset then
|
||||||
* verify that the compression algorithm
|
* verify that the compression algorithm
|
||||||
@ -3524,6 +3582,56 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
|
|||||||
return (zfs_secpolicy_setprop(dsname, prop, pair, CRED()));
|
return (zfs_secpolicy_setprop(dsname, prop, pair, CRED()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Activates a feature on a pool in response to a property setting. This
|
||||||
|
* creates a new sync task which modifies the pool to reflect the feature
|
||||||
|
* as being active.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
zfs_prop_activate_feature(dsl_pool_t *dp, zfeature_info_t *feature)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
/* EBUSY here indicates that the feature is already active */
|
||||||
|
err = dsl_sync_task_do(dp, zfs_prop_activate_feature_check,
|
||||||
|
zfs_prop_activate_feature_sync, dp->dp_spa, feature, 2);
|
||||||
|
|
||||||
|
if (err != 0 && err != EBUSY)
|
||||||
|
return (err);
|
||||||
|
else
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Checks for a race condition to make sure we don't increment a feature flag
|
||||||
|
* multiple times.
|
||||||
|
*/
|
||||||
|
/*ARGSUSED*/
|
||||||
|
static int
|
||||||
|
zfs_prop_activate_feature_check(void *arg1, void *arg2, dmu_tx_t *tx)
|
||||||
|
{
|
||||||
|
spa_t *spa = arg1;
|
||||||
|
zfeature_info_t *feature = arg2;
|
||||||
|
|
||||||
|
if (!spa_feature_is_active(spa, feature))
|
||||||
|
return (0);
|
||||||
|
else
|
||||||
|
return (EBUSY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The callback invoked on feature activation in the sync task caused by
|
||||||
|
* zfs_prop_activate_feature.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
zfs_prop_activate_feature_sync(void *arg1, void *arg2, dmu_tx_t *tx)
|
||||||
|
{
|
||||||
|
spa_t *spa = arg1;
|
||||||
|
zfeature_info_t *feature = arg2;
|
||||||
|
|
||||||
|
spa_feature_incr(spa, feature, tx);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Removes properties from the given props list that fail permission checks
|
* Removes properties from the given props list that fail permission checks
|
||||||
* needed to clear them and to restore them in case of a receive error. For each
|
* needed to clear them and to restore them in case of a receive error. For each
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <sys/zfs_context.h>
|
#include <sys/zfs_context.h>
|
||||||
#include <sys/compress.h>
|
#include <sys/compress.h>
|
||||||
@ -50,6 +53,7 @@ zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
|
|||||||
{gzip_compress, gzip_decompress, 8, "gzip-8"},
|
{gzip_compress, gzip_decompress, 8, "gzip-8"},
|
||||||
{gzip_compress, gzip_decompress, 9, "gzip-9"},
|
{gzip_compress, gzip_decompress, 9, "gzip-9"},
|
||||||
{zle_compress, zle_decompress, 64, "zle"},
|
{zle_compress, zle_decompress, 64, "zle"},
|
||||||
|
{lz4_compress, lz4_decompress, 0, "lz4"},
|
||||||
};
|
};
|
||||||
|
|
||||||
enum zio_compress
|
enum zio_compress
|
||||||
|
@ -202,6 +202,7 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c optional zfs compile-wit
|
|||||||
cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c optional zfs compile-with "${ZFS_C}"
|
cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c optional zfs compile-with "${ZFS_C}"
|
||||||
cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}"
|
cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}"
|
||||||
cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}"
|
cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}"
|
||||||
|
cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}"
|
||||||
cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}"
|
cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}"
|
||||||
cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs compile-with "${ZFS_C}"
|
cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs compile-with "${ZFS_C}"
|
||||||
cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c optional zfs compile-with "${ZFS_C}"
|
cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c optional zfs compile-with "${ZFS_C}"
|
||||||
|
Loading…
Reference in New Issue
Block a user