Print this page
Use the LZ4 algorithm to compress metadata when the corresponding feature is enabled

*** 22,31 **** --- 22,32 ---- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014 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. */ #include <sys/dmu.h> #include <sys/dmu_impl.h> #include <sys/dmu_tx.h> #include <sys/dbuf.h>
*** 42,51 **** --- 43,53 ---- #include <sys/zfs_ioctl.h> #include <sys/zap.h> #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> #endif
*** 1588,1600 **** if (ismd) { /* * XXX -- we should design a compression algorithm * that specializes in arrays of bps. */ ! compress = zfs_mdcomp_disable ? ZIO_COMPRESS_EMPTY : ! ZIO_COMPRESS_LZJB; /* * Metadata always gets checksummed. If the data * checksum is multi-bit correctable, and it's not a * ZBT-style checksum, then it's suitable for metadata * as well. Otherwise, the metadata checksum defaults --- 1590,1610 ---- 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; + } + /* * Metadata always gets checksummed. If the data * checksum is multi-bit correctable, and it's not a * ZBT-style checksum, then it's suitable for metadata * as well. Otherwise, the metadata checksum defaults