From owner-svn-src-all@FreeBSD.ORG Tue Jul 1 21:19:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43BF3364; Tue, 1 Jul 2014 21:19:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23BDF2F89; Tue, 1 Jul 2014 21:19:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s61LJCQ6005725; Tue, 1 Jul 2014 21:19:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s61LJBqN005718; Tue, 1 Jul 2014 21:19:11 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201407012119.s61LJBqN005718@svn.freebsd.org> From: Xin LI Date: Tue, 1 Jul 2014 21:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r268121 - vendor-sys/illumos/dist/common/zfs vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/man/man5 X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jul 2014 21:19:12 -0000 Author: delphij Date: Tue Jul 1 21:19:10 2014 New Revision: 268121 URL: http://svnweb.freebsd.org/changeset/base/268121 Log: 4924 LZ4 Compression for metadata Reviewed by Matthew Ahrens Reviewed by Saso Kiselkov Approved by: Christopher Siden illumos/illumos-gate@b8289d24d866c1af02d7007348f7f057693c15d3 Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Changes in other areas also in this revision: Modified: vendor/illumos/dist/man/man5/zpool-features.5 Modified: vendor-sys/illumos/dist/common/zfs/zfeature_common.c ============================================================================== --- vendor-sys/illumos/dist/common/zfs/zfeature_common.c Tue Jul 1 21:16:27 2014 (r268120) +++ vendor-sys/illumos/dist/common/zfs/zfeature_common.c Tue Jul 1 21:19:10 2014 (r268121) @@ -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", Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Tue Jul 1 21:16:27 2014 (r268120) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/dmu.c Tue Jul 1 21:19:10 2014 (r268121) @@ -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 #include @@ -44,6 +45,7 @@ #include #include #include +#include #ifdef _KERNEL #include #include @@ -1635,8 +1637,16 @@ dmu_write_policy(objset_t *os, dnode_t * * 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 Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Tue Jul 1 21:16:27 2014 (r268120) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c Tue Jul 1 21:19:10 2014 (r268121) @@ -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 * 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); } Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 1 21:16:27 2014 (r268120) +++ vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 1 21:19:10 2014 (r268121) @@ -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. */ /* @@ -2453,37 +2454,6 @@ zfs_prop_set_special(const char *dsname, } 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; }