diff options
author | Justin T. Gibbs <[email protected]> | 2015-07-06 03:55:32 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-07-10 12:11:45 -0700 |
commit | 99197f034ea0a7e227116e0cec00fe55061bffa7 (patch) | |
tree | d2394aefc5b53962c03542d763c6950b5ad36484 /module/zfs/zio_compress.c | |
parent | 15cfbb38fd6248529bf16f0cdc4ebb7adf38ab98 (diff) |
Illumos 5661 - ZFS: "compression = on" should use lz4 if feature is enabled
5661 ZFS: "compression = on" should use lz4 if feature is enabled
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Josef 'Jeff' Sipek <[email protected]>
Reviewed by: Xin LI <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
References:
https://github.com/illumos/illumos-gate/commit/db1741f
https://www.illumos.org/issues/5661
Ported-by: kernelOfTruth [email protected]
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #3571
Diffstat (limited to 'module/zfs/zio_compress.c')
-rw-r--r-- | module/zfs/zio_compress.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/module/zfs/zio_compress.c b/module/zfs/zio_compress.c index 074462349..6b8d6c39b 100644 --- a/module/zfs/zio_compress.c +++ b/module/zfs/zio_compress.c @@ -34,6 +34,7 @@ #include <sys/zfs_context.h> #include <sys/compress.h> #include <sys/spa.h> +#include <sys/zfeature.h> #include <sys/zio.h> #include <sys/zio_compress.h> @@ -61,19 +62,27 @@ zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = { }; 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); + ASSERT(parent != ZIO_COMPRESS_INHERIT); - if (child == ZIO_COMPRESS_INHERIT) - return (parent); + result = child; + if (result == ZIO_COMPRESS_INHERIT) + result = parent; - if (child == ZIO_COMPRESS_ON) - return (ZIO_COMPRESS_ON_VALUE); + 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 |