diff options
| author | Keith M Wesolowski <wesolows@foobazco.org> | 2014-06-27 20:11:35 +0000 |
|---|---|---|
| committer | Keith M Wesolowski <wesolows@foobazco.org> | 2014-06-27 20:11:35 +0000 |
| commit | 909cf22c12f3c9fac948df639bc983d462fc5304 (patch) | |
| tree | 3bda074e7117ba0d9e57db8abbeca1aa9a83ecd6 | |
| parent | f9e983a7e70d3f6ddba0b0e3f2acbbfbf7ebec63 (diff) | |
| parent | b461c7460e5e77cf65f00151162e654220c6e2fb (diff) | |
| download | illumos-joyent-909cf22c12f3c9fac948df639bc983d462fc5304.tar.gz | |
[illumos-gate merge]
commit b461c7460e5e77cf65f00151162e654220c6e2fb
4929 want prevsnap property
commit b8289d24d866c1af02d7007348f7f057693c15d3
4924 LZ4 Compression for metadata
| -rw-r--r-- | usr/src/common/zfs/zfeature_common.c | 3 | ||||
| -rw-r--r-- | usr/src/common/zfs/zfs_prop.c | 2 | ||||
| -rw-r--r-- | usr/src/man/man5/zpool-features.5 | 15 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/zfs/dmu.c | 14 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/zfs/dsl_dataset.c | 8 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/zfs/spa.c | 18 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/zfs/zfs_ioctl.c | 32 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/fs/zfs.h | 1 |
8 files changed, 50 insertions, 43 deletions
diff --git a/usr/src/common/zfs/zfeature_common.c b/usr/src/common/zfs/zfeature_common.c index 447c64cc20..9b046ab07d 100644 --- a/usr/src/common/zfs/zfeature_common.c +++ b/usr/src/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 @@ -169,7 +170,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/usr/src/common/zfs/zfs_prop.c b/usr/src/common/zfs/zfs_prop.c index d093ecaafe..e718baa32c 100644 --- a/usr/src/common/zfs/zfs_prop.c +++ b/usr/src/common/zfs/zfs_prop.c @@ -423,6 +423,8 @@ zfs_prop_init(void) PROP_READONLY, ZFS_TYPE_DATASET, "OBJSETID"); zprop_register_hidden(ZFS_PROP_INCONSISTENT, "inconsistent", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_DATASET, "INCONSISTENT"); + zprop_register_hidden(ZFS_PROP_PREV_SNAP, "prevsnap", PROP_TYPE_STRING, + PROP_READONLY, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, "PREVSNAP"); /* oddball properties */ zprop_register_impl(ZFS_PROP_CREATION, "creation", PROP_TYPE_NUMBER, 0, diff --git a/usr/src/man/man5/zpool-features.5 b/usr/src/man/man5/zpool-features.5 index d21ffc9f5e..24398124f0 100644 --- a/usr/src/man/man5/zpool-features.5 +++ b/usr/src/man/man5/zpool-features.5 @@ -243,13 +243,14 @@ giving approximately 10% better compression ratio. When the \fBlz4_compress\fR feature is set to \fBenabled\fR, the administrator can turn on \fBlz4\fR compression on any dataset on the -pool using the \fBzfs\fR(1M) command. Please note that doing so will -immediately activate the \fBlz4_compress\fR feature on the underlying -pool (even before any data is written), and the feature will not be -deactivated. Since this feature is not read-only compatible, this -operation will render the pool unimportable on systems without support -for the \fBlz4_compress\fR feature. Booting off of \fBlz4\fR-compressed -root pools is supported. +pool using the \fBzfs\fR(1M) command. Also, all newly written metadata +will be compressed with \fBlz4\fR algorithm. Since this feature is not +read-only compatible, this operation will render the pool unimportable +on systems without support for the \fBlz4_compress\fR feature. Booting +off of \fBlz4\fR-compressed root pools is supported. + +This feature becomes \fBactive\fR as soon as it is enabled and will +never return to being \fBenabled\fB. .RE .sp diff --git a/usr/src/uts/common/fs/zfs/dmu.c b/usr/src/uts/common/fs/zfs/dmu.c index 2875481b53..7ecea0c28d 100644 --- a/usr/src/uts/common/fs/zfs/dmu.c +++ b/usr/src/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/vmsystm.h> #include <sys/zfs_znode.h> @@ -1636,8 +1638,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/usr/src/uts/common/fs/zfs/dsl_dataset.c b/usr/src/uts/common/fs/zfs/dsl_dataset.c index c587237969..425c0d4551 100644 --- a/usr/src/uts/common/fs/zfs/dsl_dataset.c +++ b/usr/src/uts/common/fs/zfs/dsl_dataset.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. */ @@ -1543,6 +1543,12 @@ dsl_dataset_stats(dsl_dataset_t *ds, nvlist_t *nv) ds->ds_phys->ds_unique_bytes); get_clones_stat(ds, nv); } else { + if (ds->ds_prev != NULL && ds->ds_prev != dp->dp_origin_snap) { + char buf[MAXNAMELEN]; + dsl_dataset_name(ds->ds_prev, buf); + dsl_prop_nvlist_add_string(nv, ZFS_PROP_PREV_SNAP, buf); + } + dsl_dir_stats(ds->ds_dir, nv); } diff --git a/usr/src/uts/common/fs/zfs/spa.c b/usr/src/uts/common/fs/zfs/spa.c index 2aedc4279d..c8cabb2c32 100644 --- a/usr/src/uts/common/fs/zfs/spa.c +++ b/usr/src/uts/common/fs/zfs/spa.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2014 by Delphix. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2013, 2014, Nexenta Systems, Inc. All rights reserved. */ /* @@ -6106,6 +6106,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/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c index 14fe1f5bd4..804c631f64 100644 --- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c @@ -27,6 +27,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. */ /* @@ -2484,37 +2485,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; } diff --git a/usr/src/uts/common/sys/fs/zfs.h b/usr/src/uts/common/sys/fs/zfs.h index 01deecdf02..f1615194b1 100644 --- a/usr/src/uts/common/sys/fs/zfs.h +++ b/usr/src/uts/common/sys/fs/zfs.h @@ -147,6 +147,7 @@ typedef enum { ZFS_PROP_FILESYSTEM_COUNT, ZFS_PROP_SNAPSHOT_COUNT, ZFS_PROP_REDUNDANT_METADATA, + ZFS_PROP_PREV_SNAP, ZFS_NUM_PROPS } zfs_prop_t; |
