summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-07-15 05:42:09 +0000
committerdelphij <delphij@FreeBSD.org>2014-07-15 05:42:09 +0000
commit4af6f088fb20b549ad05b7a5c54c4a56e4961d30 (patch)
tree1510ca8f275d04bcde0105acc3d460f5c21e3f56
parent5cce10db7bcae4a96a6910d12d48309059f48318 (diff)
downloadFreeBSD-src-4af6f088fb20b549ad05b7a5c54c4a56e4961d30.zip
FreeBSD-src-4af6f088fb20b549ad05b7a5c54c4a56e4961d30.tar.gz
MFC r268126: MFV r268121:
4924 LZ4 Compression for metadata
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool-features.721
-rw-r--r--sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c3
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c14
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c18
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c32
5 files changed, 44 insertions, 44 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
index e2caa64..d62b30b 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
@@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 30, 2014
+.Dd July 1, 2014
.Dt ZPOOL-FEATURES 7
.Os
.Sh NAME
@@ -235,14 +235,11 @@ administrator can turn on
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
-.Pq even before any data is written ,
-and the feature will not be
-deactivated.
+command.
+Also, all newly written metadata
+will be compressed with
+.Sy lz4
+algorithm.
Since this feature is not read-only compatible, this
operation will render the pool unimportable on systems without support
for the
@@ -251,6 +248,12 @@ feature.
Booting off of
.Sy lz4
-compressed root pools is supported.
+.Pp
+This feature becomes
+.Sy active
+as soon as it is enabled and will
+never return to being
+.Sy enabled .
.It Sy multi_vdev_crash_dump
.Bl -column "READ\-ONLY COMPATIBLE" "com.joyent:multi_vdev_crash_dump"
.It GUID Ta com.joyent:multi_vdev_crash_dump
diff --git a/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c b/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
index 163dffe..65d2858 100644
--- a/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
+++ b/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
@@ -23,6 +23,7 @@
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.
*/
#ifdef _KERNEL
@@ -168,7 +169,7 @@ zpool_feature_init(void)
zfeature_register(SPA_FEATURE_LZ4_COMPRESS,
"org.illumos:lz4_compress", "lz4_compress",
"LZ4 compression algorithm support.", B_FALSE, B_FALSE,
- B_FALSE, NULL);
+ B_TRUE, NULL);
zfeature_register(SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,
"com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump",
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
index 91881ff..d82f134 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
@@ -24,6 +24,7 @@
*/
/* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */
/* Copyright (c) 2013, Joyent, Inc. All rights reserved. */
+/* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. */
#include <sys/dmu.h>
#include <sys/dmu_impl.h>
@@ -44,6 +45,7 @@
#include <sys/zio_checksum.h>
#include <sys/zio_compress.h>
#include <sys/sa.h>
+#include <sys/zfeature.h>
#ifdef _KERNEL
#include <sys/vm.h>
#include <sys/zfs_znode.h>
@@ -1707,8 +1709,16 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp)
* XXX -- we should design a compression algorithm
* that specializes in arrays of bps.
*/
- compress = zfs_mdcomp_disable ? ZIO_COMPRESS_EMPTY :
- ZIO_COMPRESS_LZJB;
+ 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;
+ }
/*
* Metadata always gets checksummed. If the data
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
index afc240b..ed09edc 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -22,7 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright (c) 2013, 2014, Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2013 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
*/
@@ -6429,6 +6429,22 @@ spa_sync_upgrades(spa_t *spa, dmu_tx_t *tx)
spa->spa_uberblock.ub_version >= SPA_VERSION_FEATURES) {
spa_feature_create_zap_objects(spa, tx);
}
+
+ /*
+ * LZ4_COMPRESS feature's behaviour was changed to activate_on_enable
+ * when possibility to use lz4 compression for metadata was added
+ * Old pools that have this feature enabled must be upgraded to have
+ * this feature active
+ */
+ if (spa->spa_uberblock.ub_version >= SPA_VERSION_FEATURES) {
+ boolean_t lz4_en = spa_feature_is_enabled(spa,
+ SPA_FEATURE_LZ4_COMPRESS);
+ boolean_t lz4_ac = spa_feature_is_active(spa,
+ SPA_FEATURE_LZ4_COMPRESS);
+
+ if (lz4_en && !lz4_ac)
+ spa_feature_incr(spa, SPA_FEATURE_LZ4_COMPRESS, tx);
+ }
rrw_exit(&dp->dp_config_rwlock, FTAG);
}
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
index fb925be..1e536e3 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
@@ -29,6 +29,7 @@
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2013 Steven Hartland. All rights reserved.
+ * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -2504,37 +2505,6 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source,
}
break;
}
- case ZFS_PROP_COMPRESSION:
- {
- if (intval == ZIO_COMPRESS_LZ4) {
- spa_t *spa;
-
- if ((err = spa_open(dsname, &spa, FTAG)) != 0)
- return (err);
-
- /*
- * Setting the LZ4 compression algorithm activates
- * the feature.
- */
- if (!spa_feature_is_active(spa,
- SPA_FEATURE_LZ4_COMPRESS)) {
- if ((err = zfs_prop_activate_feature(spa,
- SPA_FEATURE_LZ4_COMPRESS)) != 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:
err = -1;
}
OpenPOWER on IntegriCloud