svn commit: r288542 - in stable/10: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
Alexander Motin
mav at FreeBSD.org
Sat Oct 3 07:23:22 UTC 2015
Author: mav
Date: Sat Oct 3 07:23:19 2015
New Revision: 288542
URL: https://svnweb.freebsd.org/changeset/base/288542
Log:
MFC r286547:
5661 ZFS: "compression = on" should use lz4 if feature is enabled
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc at josefsipek.net>
Reviewed by: Xin LI <delphij at freebsd.org>
Approved by: Robert Mustacchi <rm at joyent.com>
Author: Justin T. Gibbs <justing at spectralogic.com>
illumos/illumos-gate at db1741f555ec79def5e9846e6bfd132248514ffe
Modified:
stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 3 07:22:24 2015 (r288541)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sat Oct 3 07:23:19 2015 (r288542)
@@ -939,7 +939,23 @@ Disabling checksums is
.Em NOT
a recommended practice.
.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle | Cm lz4
-Controls the compression algorithm used for this dataset. The
+Controls the compression algorithm used for this dataset.
+Setting compression to
+.Cm on
+indicates that the current default compression algorithm should be used.
+The default balances compression and decompression speed, with compression
+ratio and is expected to work well on a wide variety of workloads.
+Unlike all other settings for this property, on does not select a fixed
+compression type.
+As new compression algorithms are added to ZFS and enabled on a pool, the
+default compression algorithm may change.
+The current default compression algorthm is either
+.Cm lzjb
+or, if the
+.Sy lz4_compress
+feature is enabled,
+.Cm lz4 .
+The
.Cm lzjb
compression algorithm is optimized for performance while providing decent data
compression. Setting compression to
Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:22:24 2015 (r288541)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 07:23:19 2015 (r288542)
@@ -1785,19 +1785,15 @@ dmu_write_policy(objset_t *os, dnode_t *
* 3. all other level 0 blocks
*/
if (ismd) {
- /*
- * XXX -- we should design a compression algorithm
- * that specializes in arrays of bps.
- */
- boolean_t lz4_ac = spa_feature_is_active(os->os_spa,
- SPA_FEATURE_LZ4_COMPRESS);
-
if (zfs_mdcomp_disable) {
compress = ZIO_COMPRESS_EMPTY;
- } else if (lz4_ac) {
- compress = ZIO_COMPRESS_LZ4;
} else {
- compress = ZIO_COMPRESS_LZJB;
+ /*
+ * XXX -- we should design a compression algorithm
+ * that specializes in arrays of bps.
+ */
+ compress = zio_compress_select(os->os_spa,
+ ZIO_COMPRESS_ON, ZIO_COMPRESS_ON);
}
/*
@@ -1830,7 +1826,8 @@ dmu_write_policy(objset_t *os, dnode_t *
compress = ZIO_COMPRESS_OFF;
checksum = ZIO_CHECKSUM_NOPARITY;
} else {
- compress = zio_compress_select(dn->dn_compress, compress);
+ compress = zio_compress_select(os->os_spa, dn->dn_compress,
+ compress);
checksum = (dedup_checksum == ZIO_CHECKSUM_OFF) ?
zio_checksum_select(dn->dn_checksum, checksum) :
Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:22:24 2015 (r288541)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Sat Oct 3 07:23:19 2015 (r288542)
@@ -151,7 +151,8 @@ compression_changed_cb(void *arg, uint64
*/
ASSERT(newval != ZIO_COMPRESS_INHERIT);
- os->os_compress = zio_compress_select(newval, ZIO_COMPRESS_ON_VALUE);
+ os->os_compress = zio_compress_select(os->os_spa, newval,
+ ZIO_COMPRESS_ON);
}
static void
@@ -408,7 +409,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat
} else {
/* It's the meta-objset. */
os->os_checksum = ZIO_CHECKSUM_FLETCHER_4;
- os->os_compress = ZIO_COMPRESS_LZJB;
+ os->os_compress = ZIO_COMPRESS_ON;
os->os_copies = spa_max_replication(spa);
os->os_dedup_checksum = ZIO_CHECKSUM_OFF;
os->os_dedup_verify = B_FALSE;
Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Oct 3 07:22:24 2015 (r288541)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Sat Oct 3 07:23:19 2015 (r288542)
@@ -125,15 +125,19 @@ enum zio_compress {
*/
#define ZIO_COMPRESS_LEGACY_FUNCTIONS ZIO_COMPRESS_LZ4
-/* N.B. when altering this value, also change BOOTFS_COMPRESS_VALID below */
-#define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB
-#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
+/*
+ * The meaning of "compress = on" selected by the compression features enabled
+ * on a given pool.
+ */
+#define ZIO_COMPRESS_LEGACY_ON_VALUE ZIO_COMPRESS_LZJB
+#define ZIO_COMPRESS_LZ4_ON_VALUE ZIO_COMPRESS_LZ4
+
+#define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF
#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_ON || \
(compress) == ZIO_COMPRESS_OFF)
#define ZIO_FAILURE_MODE_WAIT 0
@@ -581,8 +585,8 @@ extern enum zio_checksum zio_checksum_se
enum zio_checksum parent);
extern enum zio_checksum zio_checksum_dedup_select(spa_t *spa,
enum zio_checksum child, enum zio_checksum parent);
-extern enum zio_compress zio_compress_select(enum zio_compress child,
- enum zio_compress parent);
+extern enum zio_compress zio_compress_select(spa_t *spa,
+ enum zio_compress child, enum zio_compress parent);
extern void zio_suspend(spa_t *spa, zio_t *zio);
extern int zio_resume(spa_t *spa);
Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Sat Oct 3 07:22:24 2015 (r288541)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c Sat Oct 3 07:23:19 2015 (r288542)
@@ -35,6 +35,7 @@
#include <sys/compress.h>
#include <sys/kstat.h>
#include <sys/spa.h>
+#include <sys/zfeature.h>
#include <sys/zio.h>
#include <sys/zio_compress.h>
@@ -81,19 +82,27 @@ zio_compress_info_t zio_compress_table[Z
};
enum zio_compress
-zio_compress_select(enum zio_compress child, enum zio_compress parent)
+zio_compress_select(spa_t *spa, enum zio_compress child,
+ enum zio_compress parent)
{
+ enum zio_compress result;
+
ASSERT(child < ZIO_COMPRESS_FUNCTIONS);
ASSERT(parent < ZIO_COMPRESS_FUNCTIONS);
- ASSERT(parent != ZIO_COMPRESS_INHERIT && parent != ZIO_COMPRESS_ON);
-
- if (child == ZIO_COMPRESS_INHERIT)
- return (parent);
+ ASSERT(parent != ZIO_COMPRESS_INHERIT);
- if (child == ZIO_COMPRESS_ON)
- return (ZIO_COMPRESS_ON_VALUE);
+ result = child;
+ if (result == ZIO_COMPRESS_INHERIT)
+ result = parent;
+
+ if (result == ZIO_COMPRESS_ON) {
+ if (spa_feature_is_active(spa, SPA_FEATURE_LZ4_COMPRESS))
+ result = ZIO_COMPRESS_LZ4_ON_VALUE;
+ else
+ result = ZIO_COMPRESS_LEGACY_ON_VALUE;
+ }
- return (child);
+ return (result);
}
size_t
More information about the svn-src-stable-10
mailing list