2020-04-14 18:36:28 +00:00
|
|
|
.if !defined(WITH_CTF)
|
|
|
|
WITH_CTF=1
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.include <bsd.sys.mk>
|
|
|
|
|
2020-06-20 02:08:59 +00:00
|
|
|
SRCDIR=${.CURDIR}
|
2020-04-14 18:36:28 +00:00
|
|
|
INCDIR=${.CURDIR:H}/include
|
|
|
|
|
|
|
|
KMOD= openzfs
|
|
|
|
|
|
|
|
.PATH: ${SRCDIR}/avl \
|
|
|
|
${SRCDIR}/lua \
|
|
|
|
${SRCDIR}/nvpair \
|
|
|
|
${SRCDIR}/os/freebsd/spl \
|
|
|
|
${SRCDIR}/os/freebsd/zfs \
|
|
|
|
${SRCDIR}/unicode \
|
|
|
|
${SRCDIR}/zcommon \
|
Add zstd support to zfs
This PR adds two new compression types, based on ZStandard:
- zstd: A basic ZStandard compression algorithm Available compression.
Levels for zstd are zstd-1 through zstd-19, where the compression
increases with every level, but speed decreases.
- zstd-fast: A faster version of the ZStandard compression algorithm
zstd-fast is basically a "negative" level of zstd. The compression
decreases with every level, but speed increases.
Available compression levels for zstd-fast:
- zstd-fast-1 through zstd-fast-10
- zstd-fast-20 through zstd-fast-100 (in increments of 10)
- zstd-fast-500 and zstd-fast-1000
For more information check the man page.
Implementation details:
Rather than treat each level of zstd as a different algorithm (as was
done historically with gzip), the block pointer `enum zio_compress`
value is simply zstd for all levels, including zstd-fast, since they all
use the same decompression function.
The compress= property (a 64bit unsigned integer) uses the lower 7 bits
to store the compression algorithm (matching the number of bits used in
a block pointer, as the 8th bit was borrowed for embedded block
pointers). The upper bits are used to store the compression level.
It is necessary to be able to determine what compression level was used
when later reading a block back, so the concept used in LZ4, where the
first 32bits of the on-disk value are the size of the compressed data
(since the allocation is rounded up to the nearest ashift), was
extended, and we store the version of ZSTD and the level as well as the
compressed size. This value is returned when decompressing a block, so
that if the block needs to be recompressed (L2ARC, nop-write, etc), that
the same parameters will be used to result in the matching checksum.
All of the internal ZFS code ( `arc_buf_hdr_t`, `objset_t`,
`zio_prop_t`, etc.) uses the separated _compress and _complevel
variables. Only the properties ZAP contains the combined/bit-shifted
value. The combined value is split when the compression_changed_cb()
callback is called, and sets both objset members (os_compress and
os_complevel).
The userspace tools all use the combined/bit-shifted value.
Additional notes:
zdb can now also decode the ZSTD compression header (flag -Z) and
inspect the size, version and compression level saved in that header.
For each record, if it is ZSTD compressed, the parameters of the decoded
compression header get printed.
ZSTD is included with all current tests and new tests are added
as-needed.
Per-dataset feature flags now get activated when the property is set.
If a compression algorithm requires a feature flag, zfs activates the
feature when the property is set, rather than waiting for the first
block to be born. This is currently only used by zstd but can be
extended as needed.
Portions-Sponsored-By: The FreeBSD Foundation
Co-authored-by: Allan Jude <allanjude@freebsd.org>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Co-authored-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Co-authored-by: Michael Niewöhner <foss@mniewoehner.de>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Allan Jude <allanjude@freebsd.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Closes #6247
Closes #9024
Closes #10277
Closes #10278
2020-08-18 17:10:17 +00:00
|
|
|
${SRCDIR}/zfs \
|
|
|
|
${SRCDIR}/zstd \
|
|
|
|
${SRCDIR}/zstd/lib
|
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
|
|
|
|
|
2020-06-20 02:08:59 +00:00
|
|
|
CFLAGS+= -I${.OBJDIR:H}/include
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS+= -I${INCDIR}
|
|
|
|
CFLAGS+= -I${INCDIR}/spl
|
|
|
|
CFLAGS+= -I${INCDIR}/os/freebsd
|
|
|
|
CFLAGS+= -I${INCDIR}/os/freebsd/spl
|
|
|
|
CFLAGS+= -I${INCDIR}/os/freebsd/zfs
|
Add zstd support to zfs
This PR adds two new compression types, based on ZStandard:
- zstd: A basic ZStandard compression algorithm Available compression.
Levels for zstd are zstd-1 through zstd-19, where the compression
increases with every level, but speed decreases.
- zstd-fast: A faster version of the ZStandard compression algorithm
zstd-fast is basically a "negative" level of zstd. The compression
decreases with every level, but speed increases.
Available compression levels for zstd-fast:
- zstd-fast-1 through zstd-fast-10
- zstd-fast-20 through zstd-fast-100 (in increments of 10)
- zstd-fast-500 and zstd-fast-1000
For more information check the man page.
Implementation details:
Rather than treat each level of zstd as a different algorithm (as was
done historically with gzip), the block pointer `enum zio_compress`
value is simply zstd for all levels, including zstd-fast, since they all
use the same decompression function.
The compress= property (a 64bit unsigned integer) uses the lower 7 bits
to store the compression algorithm (matching the number of bits used in
a block pointer, as the 8th bit was borrowed for embedded block
pointers). The upper bits are used to store the compression level.
It is necessary to be able to determine what compression level was used
when later reading a block back, so the concept used in LZ4, where the
first 32bits of the on-disk value are the size of the compressed data
(since the allocation is rounded up to the nearest ashift), was
extended, and we store the version of ZSTD and the level as well as the
compressed size. This value is returned when decompressing a block, so
that if the block needs to be recompressed (L2ARC, nop-write, etc), that
the same parameters will be used to result in the matching checksum.
All of the internal ZFS code ( `arc_buf_hdr_t`, `objset_t`,
`zio_prop_t`, etc.) uses the separated _compress and _complevel
variables. Only the properties ZAP contains the combined/bit-shifted
value. The combined value is split when the compression_changed_cb()
callback is called, and sets both objset members (os_compress and
os_complevel).
The userspace tools all use the combined/bit-shifted value.
Additional notes:
zdb can now also decode the ZSTD compression header (flag -Z) and
inspect the size, version and compression level saved in that header.
For each record, if it is ZSTD compressed, the parameters of the decoded
compression header get printed.
ZSTD is included with all current tests and new tests are added
as-needed.
Per-dataset feature flags now get activated when the property is set.
If a compression algorithm requires a feature flag, zfs activates the
feature when the property is set, rather than waiting for the first
block to be born. This is currently only used by zstd but can be
extended as needed.
Portions-Sponsored-By: The FreeBSD Foundation
Co-authored-by: Allan Jude <allanjude@freebsd.org>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Co-authored-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Co-authored-by: Michael Niewöhner <foss@mniewoehner.de>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Allan Jude <allanjude@freebsd.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Closes #6247
Closes #9024
Closes #10277
Closes #10278
2020-08-18 17:10:17 +00:00
|
|
|
CFLAGS+= -I${SRCDIR}/zstd/include
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h
|
|
|
|
|
2020-08-18 16:57:07 +00:00
|
|
|
CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS -D__BSD_VISIBLE=1 \
|
|
|
|
-DHAVE_UIO_ZEROCOPY -DWITHOUT_NETDUMP -D__KERNEL -D_SYS_CONDVAR_H_ \
|
2020-08-20 17:55:02 +00:00
|
|
|
-D_SYS_VMEM_H_ -DKDTRACE_HOOKS -DSMP -DHAVE_KSID -DCOMPAT_FREEBSD11
|
2020-04-14 18:36:28 +00:00
|
|
|
|
|
|
|
.if ${MACHINE_ARCH} == "amd64"
|
2020-07-26 03:09:50 +00:00
|
|
|
CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F -DHAVE_SSSE3
|
2020-04-14 18:36:28 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(WITH_DEBUG) && ${WITH_DEBUG} == "true"
|
|
|
|
CFLAGS+= -DINVARIANTS -DWITNESS -g -O0 -DZFS_DEBUG -DOPENSOLARIS_WITNESS
|
|
|
|
.else
|
|
|
|
CFLAGS += -DNDEBUG
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(WITH_VFS_DEBUG) && ${WITH_VFS_DEBUG} == "true"
|
|
|
|
# kernel must also be built with this option for this to work
|
|
|
|
CFLAGS+= -DDEBUG_VFS_LOCKS
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(WITH_GCOV) && ${WITH_GCOV} == "true"
|
|
|
|
CFLAGS+= -fprofile-arcs -ftest-coverage
|
|
|
|
.endif
|
|
|
|
|
|
|
|
DEBUG_FLAGS=-g
|
|
|
|
|
|
|
|
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
|
|
|
|
${MACHINE_ARCH} == "arm"
|
|
|
|
CFLAGS+= -DBITS_PER_LONG=32
|
|
|
|
.else
|
|
|
|
CFLAGS+= -DBITS_PER_LONG=64
|
|
|
|
.endif
|
|
|
|
|
|
|
|
SRCS= vnode_if.h device_if.h bus_if.h
|
|
|
|
|
|
|
|
# avl
|
|
|
|
SRCS+= avl.c
|
|
|
|
|
|
|
|
#lua
|
|
|
|
SRCS+= lapi.c \
|
|
|
|
lauxlib.c \
|
|
|
|
lbaselib.c \
|
|
|
|
lcode.c \
|
|
|
|
lcompat.c \
|
|
|
|
lcorolib.c \
|
|
|
|
lctype.c \
|
|
|
|
ldebug.c \
|
|
|
|
ldo.c \
|
|
|
|
lfunc.c \
|
|
|
|
lgc.c \
|
|
|
|
llex.c \
|
|
|
|
lmem.c \
|
|
|
|
lobject.c \
|
|
|
|
lopcodes.c \
|
|
|
|
lparser.c \
|
|
|
|
lstate.c \
|
|
|
|
lstring.c \
|
|
|
|
lstrlib.c \
|
|
|
|
ltable.c \
|
|
|
|
ltablib.c \
|
|
|
|
ltm.c \
|
|
|
|
lvm.c \
|
|
|
|
lzio.c
|
|
|
|
|
|
|
|
#nvpair
|
|
|
|
SRCS+= nvpair.c \
|
|
|
|
fnvpair.c \
|
|
|
|
nvpair_alloc_spl.c \
|
|
|
|
nvpair_alloc_fixed.c
|
|
|
|
|
|
|
|
#os/freebsd/spl
|
|
|
|
SRCS+= acl_common.c \
|
|
|
|
btree.c \
|
|
|
|
callb.c \
|
|
|
|
list.c \
|
|
|
|
spl_acl.c \
|
|
|
|
spl_cmn_err.c \
|
|
|
|
spl_dtrace.c \
|
|
|
|
spl_kmem.c \
|
|
|
|
spl_kstat.c \
|
|
|
|
spl_misc.c \
|
|
|
|
spl_policy.c \
|
|
|
|
spl_string.c \
|
|
|
|
spl_sunddi.c \
|
|
|
|
spl_sysevent.c \
|
|
|
|
spl_taskq.c \
|
|
|
|
spl_uio.c \
|
|
|
|
spl_vfs.c \
|
|
|
|
spl_vm.c \
|
|
|
|
spl_zone.c \
|
|
|
|
sha256c.c \
|
|
|
|
sha512c.c \
|
|
|
|
spl_procfs_list.c \
|
|
|
|
spl_zlib.c
|
|
|
|
|
|
|
|
|
|
|
|
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
|
|
|
|
${MACHINE_ARCH} == "arm"
|
|
|
|
SRCS+= spl_atomic.c
|
|
|
|
.endif
|
|
|
|
|
|
|
|
#os/freebsd/zfs
|
2020-05-10 19:23:52 +00:00
|
|
|
SRCS+= abd_os.c \
|
2020-04-14 18:36:28 +00:00
|
|
|
crypto_os.c \
|
|
|
|
dmu_os.c \
|
|
|
|
hkdf.c \
|
|
|
|
kmod_core.c \
|
|
|
|
spa_os.c \
|
|
|
|
sysctl_os.c \
|
|
|
|
vdev_file.c \
|
|
|
|
vdev_label_os.c \
|
|
|
|
vdev_geom.c \
|
|
|
|
zfs_acl.c \
|
|
|
|
zfs_ctldir.c \
|
|
|
|
zfs_dir.c \
|
2020-07-16 04:32:50 +00:00
|
|
|
zfs_ioctl_compat.c \
|
2020-04-14 18:36:28 +00:00
|
|
|
zfs_ioctl_os.c \
|
|
|
|
zfs_log.c \
|
|
|
|
zfs_replay.c \
|
|
|
|
zfs_vfsops.c \
|
|
|
|
zfs_vnops.c \
|
|
|
|
zfs_znode.c \
|
|
|
|
zio_crypt.c \
|
|
|
|
zvol_os.c
|
|
|
|
|
|
|
|
#unicode
|
|
|
|
SRCS+= uconv.c \
|
|
|
|
u8_textprep.c
|
|
|
|
|
|
|
|
#zcommon
|
|
|
|
SRCS+= zfeature_common.c \
|
|
|
|
zfs_comutil.c \
|
|
|
|
zfs_deleg.c \
|
|
|
|
zfs_fletcher.c \
|
|
|
|
zfs_fletcher_avx512.c \
|
|
|
|
zfs_fletcher_intel.c \
|
|
|
|
zfs_fletcher_sse.c \
|
|
|
|
zfs_fletcher_superscalar.c \
|
|
|
|
zfs_fletcher_superscalar4.c \
|
|
|
|
zfs_namecheck.c \
|
|
|
|
zfs_prop.c \
|
|
|
|
zpool_prop.c \
|
|
|
|
zprop_common.c
|
|
|
|
|
|
|
|
#zfs
|
2020-05-10 19:23:52 +00:00
|
|
|
SRCS+= abd.c \
|
|
|
|
aggsum.c \
|
2020-04-14 18:36:28 +00:00
|
|
|
arc.c \
|
|
|
|
arc_os.c \
|
|
|
|
blkptr.c \
|
|
|
|
bplist.c \
|
|
|
|
bpobj.c \
|
|
|
|
cityhash.c \
|
|
|
|
dbuf.c \
|
|
|
|
dbuf_stats.c \
|
|
|
|
bptree.c \
|
|
|
|
bqueue.c \
|
|
|
|
dataset_kstats.c \
|
|
|
|
ddt.c \
|
|
|
|
ddt_zap.c \
|
|
|
|
dmu.c \
|
|
|
|
dmu_diff.c \
|
|
|
|
dmu_object.c \
|
|
|
|
dmu_objset.c \
|
|
|
|
dmu_recv.c \
|
|
|
|
dmu_redact.c \
|
|
|
|
dmu_send.c \
|
|
|
|
dmu_traverse.c \
|
|
|
|
dmu_tx.c \
|
|
|
|
dmu_zfetch.c \
|
|
|
|
dnode.c \
|
|
|
|
dnode_sync.c \
|
|
|
|
dsl_dataset.c \
|
|
|
|
dsl_deadlist.c \
|
|
|
|
dsl_deleg.c \
|
|
|
|
dsl_bookmark.c \
|
|
|
|
dsl_dir.c \
|
|
|
|
dsl_crypt.c \
|
|
|
|
dsl_destroy.c \
|
|
|
|
dsl_pool.c \
|
|
|
|
dsl_prop.c \
|
|
|
|
dsl_scan.c \
|
|
|
|
dsl_synctask.c \
|
|
|
|
dsl_userhold.c \
|
|
|
|
fm.c \
|
|
|
|
gzip.c \
|
|
|
|
lzjb.c \
|
|
|
|
lz4.c \
|
|
|
|
metaslab.c \
|
|
|
|
mmp.c \
|
|
|
|
multilist.c \
|
|
|
|
objlist.c \
|
|
|
|
pathname.c \
|
|
|
|
range_tree.c \
|
|
|
|
refcount.c \
|
|
|
|
rrwlock.c \
|
|
|
|
sa.c \
|
|
|
|
sha256.c \
|
|
|
|
skein_zfs.c \
|
|
|
|
spa.c \
|
|
|
|
spa_boot.c \
|
|
|
|
spa_checkpoint.c \
|
|
|
|
spa_config.c \
|
|
|
|
spa_errlog.c \
|
|
|
|
spa_history.c \
|
|
|
|
spa_log_spacemap.c \
|
|
|
|
spa_misc.c \
|
|
|
|
spa_stats.c \
|
|
|
|
space_map.c \
|
|
|
|
space_reftree.c \
|
|
|
|
txg.c \
|
|
|
|
uberblock.c \
|
|
|
|
unique.c \
|
|
|
|
vdev.c \
|
|
|
|
vdev_cache.c \
|
|
|
|
vdev_indirect.c \
|
|
|
|
vdev_indirect_births.c \
|
|
|
|
vdev_indirect_mapping.c \
|
|
|
|
vdev_initialize.c \
|
|
|
|
vdev_label.c \
|
|
|
|
vdev_mirror.c \
|
|
|
|
vdev_missing.c \
|
|
|
|
vdev_queue.c \
|
|
|
|
vdev_raidz.c \
|
|
|
|
vdev_raidz_math.c \
|
|
|
|
vdev_raidz_math_scalar.c \
|
2020-07-03 18:05:50 +00:00
|
|
|
vdev_rebuild.c \
|
2020-04-14 18:36:28 +00:00
|
|
|
vdev_raidz_math_avx2.c \
|
|
|
|
vdev_raidz_math_avx512bw.c \
|
|
|
|
vdev_raidz_math_avx512f.c \
|
|
|
|
vdev_raidz_math_sse2.c \
|
|
|
|
vdev_raidz_math_ssse3.c \
|
|
|
|
vdev_removal.c \
|
|
|
|
vdev_root.c \
|
|
|
|
vdev_trim.c \
|
|
|
|
zap.c \
|
|
|
|
zap_leaf.c \
|
|
|
|
zap_micro.c \
|
|
|
|
zcp.c \
|
|
|
|
zcp_get.c \
|
|
|
|
zcp_global.c \
|
|
|
|
zcp_iter.c \
|
|
|
|
zcp_set.c \
|
|
|
|
zcp_synctask.c \
|
|
|
|
zfeature.c \
|
|
|
|
zfs_byteswap.c \
|
|
|
|
zfs_debug.c \
|
|
|
|
zfs_file_os.c \
|
|
|
|
zfs_fm.c \
|
|
|
|
zfs_fuid.c \
|
|
|
|
zfs_ioctl.c \
|
|
|
|
zfs_onexit.c \
|
|
|
|
zfs_quota.c \
|
|
|
|
zfs_ratelimit.c \
|
|
|
|
zfs_rlock.c \
|
|
|
|
zfs_sa.c \
|
|
|
|
zil.c \
|
|
|
|
zio.c \
|
|
|
|
zio_checksum.c \
|
|
|
|
zio_compress.c \
|
|
|
|
zio_inject.c \
|
|
|
|
zle.c \
|
|
|
|
zrlock.c \
|
|
|
|
zthr.c \
|
|
|
|
zvol.c
|
|
|
|
|
Add zstd support to zfs
This PR adds two new compression types, based on ZStandard:
- zstd: A basic ZStandard compression algorithm Available compression.
Levels for zstd are zstd-1 through zstd-19, where the compression
increases with every level, but speed decreases.
- zstd-fast: A faster version of the ZStandard compression algorithm
zstd-fast is basically a "negative" level of zstd. The compression
decreases with every level, but speed increases.
Available compression levels for zstd-fast:
- zstd-fast-1 through zstd-fast-10
- zstd-fast-20 through zstd-fast-100 (in increments of 10)
- zstd-fast-500 and zstd-fast-1000
For more information check the man page.
Implementation details:
Rather than treat each level of zstd as a different algorithm (as was
done historically with gzip), the block pointer `enum zio_compress`
value is simply zstd for all levels, including zstd-fast, since they all
use the same decompression function.
The compress= property (a 64bit unsigned integer) uses the lower 7 bits
to store the compression algorithm (matching the number of bits used in
a block pointer, as the 8th bit was borrowed for embedded block
pointers). The upper bits are used to store the compression level.
It is necessary to be able to determine what compression level was used
when later reading a block back, so the concept used in LZ4, where the
first 32bits of the on-disk value are the size of the compressed data
(since the allocation is rounded up to the nearest ashift), was
extended, and we store the version of ZSTD and the level as well as the
compressed size. This value is returned when decompressing a block, so
that if the block needs to be recompressed (L2ARC, nop-write, etc), that
the same parameters will be used to result in the matching checksum.
All of the internal ZFS code ( `arc_buf_hdr_t`, `objset_t`,
`zio_prop_t`, etc.) uses the separated _compress and _complevel
variables. Only the properties ZAP contains the combined/bit-shifted
value. The combined value is split when the compression_changed_cb()
callback is called, and sets both objset members (os_compress and
os_complevel).
The userspace tools all use the combined/bit-shifted value.
Additional notes:
zdb can now also decode the ZSTD compression header (flag -Z) and
inspect the size, version and compression level saved in that header.
For each record, if it is ZSTD compressed, the parameters of the decoded
compression header get printed.
ZSTD is included with all current tests and new tests are added
as-needed.
Per-dataset feature flags now get activated when the property is set.
If a compression algorithm requires a feature flag, zfs activates the
feature when the property is set, rather than waiting for the first
block to be born. This is currently only used by zstd but can be
extended as needed.
Portions-Sponsored-By: The FreeBSD Foundation
Co-authored-by: Allan Jude <allanjude@freebsd.org>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Co-authored-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Co-authored-by: Michael Niewöhner <foss@mniewoehner.de>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Allan Jude <allanjude@freebsd.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Closes #6247
Closes #9024
Closes #10277
Closes #10278
2020-08-18 17:10:17 +00:00
|
|
|
#zstd
|
|
|
|
SRCS+= zfs_zstd.c \
|
|
|
|
zstd.c
|
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
beforeinstall:
|
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
mtree -eu \
|
|
|
|
-f /etc/mtree/BSD.debug.dist \
|
|
|
|
-p ${DESTDIR}/usr/lib
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.include <bsd.kmod.mk>
|
|
|
|
|
|
|
|
|
|
|
|
CFLAGS.gcc+= -Wno-pointer-to-int-cast
|
|
|
|
|
|
|
|
CFLAGS.lapi.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.lcompat.c= -Wno-cast-qual
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.lobject.c= -Wno-cast-qual
|
|
|
|
CFLAGS.ltable.c= -Wno-cast-qual
|
|
|
|
CFLAGS.lvm.c= -Wno-cast-qual
|
2020-07-26 03:09:50 +00:00
|
|
|
CFLAGS.nvpair.c= -DHAVE_RPC_TYPES -Wno-cast-qual
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.spl_string.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.spl_vm.c= -Wno-cast-qual
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.spl_zlib.c= -Wno-cast-qual
|
|
|
|
CFLAGS.abd.c= -Wno-cast-qual
|
|
|
|
CFLAGS.zfs_log.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.zfs_vnops.c= -Wno-pointer-arith
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.u8_textprep.c= -Wno-cast-qual
|
|
|
|
CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith
|
|
|
|
CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith
|
|
|
|
CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith
|
|
|
|
CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith
|
|
|
|
CFLAGS.zprop_common.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.ddt.c= -Wno-cast-qual
|
|
|
|
CFLAGS.dmu.c= -Wno-cast-qual
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.dmu_traverse.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.dsl_dir.c= -Wno-cast-qual
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.dsl_deadlist.c= -Wno-cast-qual
|
|
|
|
CFLAGS.dsl_prop.c= -Wno-cast-qual
|
|
|
|
CFLAGS.fm.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.lz4.c= -Wno-cast-qual
|
|
|
|
CFLAGS.spa.c= -Wno-cast-qual
|
|
|
|
CFLAGS.spa_misc.c= -Wno-cast-qual
|
2020-07-01 16:10:08 +00:00
|
|
|
CFLAGS.sysctl_os.c= -include ../zfs_config.h
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.vdev_raidz.c= -Wno-cast-qual
|
|
|
|
CFLAGS.vdev_raidz_math.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
|
|
|
|
CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
|
|
|
|
CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier
|
|
|
|
CFLAGS.zap_leaf.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.zap_micro.c= -Wno-cast-qual
|
2020-04-14 18:36:28 +00:00
|
|
|
CFLAGS.zcp.c= -Wno-cast-qual
|
|
|
|
CFLAGS.zfs_fm.c= -Wno-cast-qual
|
2020-06-16 23:46:04 +00:00
|
|
|
CFLAGS.zfs_ioctl.c= -Wno-cast-qual
|
|
|
|
CFLAGS.zil.c= -Wno-cast-qual
|
|
|
|
CFLAGS.zio.c= -Wno-cast-qual
|
|
|
|
CFLAGS.zrlock.c= -Wno-cast-qual
|
Add zstd support to zfs
This PR adds two new compression types, based on ZStandard:
- zstd: A basic ZStandard compression algorithm Available compression.
Levels for zstd are zstd-1 through zstd-19, where the compression
increases with every level, but speed decreases.
- zstd-fast: A faster version of the ZStandard compression algorithm
zstd-fast is basically a "negative" level of zstd. The compression
decreases with every level, but speed increases.
Available compression levels for zstd-fast:
- zstd-fast-1 through zstd-fast-10
- zstd-fast-20 through zstd-fast-100 (in increments of 10)
- zstd-fast-500 and zstd-fast-1000
For more information check the man page.
Implementation details:
Rather than treat each level of zstd as a different algorithm (as was
done historically with gzip), the block pointer `enum zio_compress`
value is simply zstd for all levels, including zstd-fast, since they all
use the same decompression function.
The compress= property (a 64bit unsigned integer) uses the lower 7 bits
to store the compression algorithm (matching the number of bits used in
a block pointer, as the 8th bit was borrowed for embedded block
pointers). The upper bits are used to store the compression level.
It is necessary to be able to determine what compression level was used
when later reading a block back, so the concept used in LZ4, where the
first 32bits of the on-disk value are the size of the compressed data
(since the allocation is rounded up to the nearest ashift), was
extended, and we store the version of ZSTD and the level as well as the
compressed size. This value is returned when decompressing a block, so
that if the block needs to be recompressed (L2ARC, nop-write, etc), that
the same parameters will be used to result in the matching checksum.
All of the internal ZFS code ( `arc_buf_hdr_t`, `objset_t`,
`zio_prop_t`, etc.) uses the separated _compress and _complevel
variables. Only the properties ZAP contains the combined/bit-shifted
value. The combined value is split when the compression_changed_cb()
callback is called, and sets both objset members (os_compress and
os_complevel).
The userspace tools all use the combined/bit-shifted value.
Additional notes:
zdb can now also decode the ZSTD compression header (flag -Z) and
inspect the size, version and compression level saved in that header.
For each record, if it is ZSTD compressed, the parameters of the decoded
compression header get printed.
ZSTD is included with all current tests and new tests are added
as-needed.
Per-dataset feature flags now get activated when the property is set.
If a compression algorithm requires a feature flag, zfs activates the
feature when the property is set, rather than waiting for the first
block to be born. This is currently only used by zstd but can be
extended as needed.
Portions-Sponsored-By: The FreeBSD Foundation
Co-authored-by: Allan Jude <allanjude@freebsd.org>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Co-authored-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Co-authored-by: Michael Niewöhner <foss@mniewoehner.de>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Signed-off-by: Allan Jude <allanjude@freebsd.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Closes #6247
Closes #9024
Closes #10277
Closes #10278
2020-08-18 17:10:17 +00:00
|
|
|
CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith
|
|
|
|
CFLAGS.zstd.c= -fno-tree-vectorize
|