2021-10-07 17:31:26 +00:00
|
|
|
#
|
|
|
|
# Shown below is a simplified dependency graph of the OpenZFS provided
|
|
|
|
# libraries. Administrative commands (`zfs`, `zpool`, etc) interface with
|
|
|
|
# the kernel modules using the `libzfs.so` and `libzfs_core.so` libraries.
|
|
|
|
# These libraries provide a stable ABI across OpenZFS point releases.
|
|
|
|
#
|
|
|
|
# The `libzpool.so` library is a user space build of the DMU and SPA layers
|
|
|
|
# used to implement debugging tools (zdb) and code validation tools (ztest).
|
|
|
|
# These library interfaces are subject to change at any time.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# CMDS: zhack/ztest/zdb/ zfs/zpool/zed/
|
|
|
|
# raidz_{test,bench} zinject/zstream
|
|
|
|
# | |
|
|
|
|
# LIBS: | | libzfsbootenv*
|
|
|
|
# | | |
|
|
|
|
# | | |
|
|
|
|
# libzpool libzfs* ----------------+
|
|
|
|
# | | | \ / | | |
|
|
|
|
# libicp --/ | | \ / | | \------- libshare
|
|
|
|
# | | \ / | |
|
|
|
|
# libzstd ---/ | \ / | \--------- libuutil
|
|
|
|
# | \ / \ | |
|
|
|
|
# libunicode --/ \ / \ | |
|
|
|
|
# \ / \ | |
|
|
|
|
# libzutil libzfs_core* | |
|
|
|
|
# | | | | \ | | | |
|
|
|
|
# | | | | | | | | |
|
|
|
|
# | | | | | | | | |
|
|
|
|
# libtpool -------------/ | | | \---- libnvpair* | | |
|
|
|
|
# | | | | | |
|
|
|
|
# libefi -----------------/ | \------ libavl* --------/ |
|
|
|
|
# | | |
|
|
|
|
# \-------- libspl ----+------/
|
|
|
|
#
|
|
|
|
# * - A stable ABI is provided for these libraries
|
|
|
|
#
|
|
|
|
#
|
2011-12-31 23:30:52 +00:00
|
|
|
# NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries
|
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
|
|
|
# These nine libraries are intermediary build components.
|
2021-10-07 17:31:26 +00:00
|
|
|
#
|
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
|
|
|
SUBDIRS = libavl libicp libshare libspl libtpool libzstd
|
2021-01-22 20:54:34 +00:00
|
|
|
CPPCHECKDIRS = libavl libicp libnvpair libshare libspl libtpool libunicode
|
|
|
|
CPPCHECKDIRS += libuutil libzfs libzfs_core libzfsbootenv libzpool libzutil
|
2020-04-14 18:36:28 +00:00
|
|
|
|
|
|
|
if BUILD_LINUX
|
|
|
|
SUBDIRS += libefi
|
2021-01-22 20:54:34 +00:00
|
|
|
CPPCHECKDIRS += libefi
|
2020-04-14 18:36:28 +00:00
|
|
|
endif
|
|
|
|
|
2020-09-12 15:19:48 +00:00
|
|
|
# libnvpair is installed as part of the final build product
|
|
|
|
# libzutil depends on it, so it must be compiled before libzutil
|
|
|
|
SUBDIRS += libnvpair
|
|
|
|
|
2020-04-14 18:36:28 +00:00
|
|
|
# libzutil depends on libefi if present
|
|
|
|
SUBDIRS += libzutil libunicode
|
2011-12-31 23:30:52 +00:00
|
|
|
|
2020-09-15 22:42:27 +00:00
|
|
|
# These five libraries, which are installed as the final build product,
|
Clean up lib dependencies
libzutil is currently statically linked into libzfs, libzfs_core and
libzpool. Avoid the unnecessary duplication by removing it from libzfs
and libzpool, and adding libzfs_core to libzpool.
Remove a few unnecessary dependencies:
- libuutil from libzfs_core
- libtirpc from libspl
- keep only libcrypto in libzfs, as we don't use any functions from
libssl
- librt is only used for clock_gettime, however on modern systems that's
in libc rather than librt. Add a configure check to see if we actually
need librt
- libdl from raidz_test
Add a few missing dependencies:
- zlib to libefi and libzfs
- libuuid to zpool, and libuuid and libudev to zed
- libnvpair uses assertions, so add assert.c to provide aok and
libspl_assertf
Sort the LDADD for programs so that libraries that satisfy dependencies
come at the end rather than the beginning of the linker command line.
Revamp the configure tests for libaries to use FIND_SYSTEM_LIBRARY
instead. This can take advantage of pkg-config, and it also avoids
polluting LIBS.
List all the required dependencies in the pkgconfig files, and move the
one for libzfs_core into the latter's directory. Install pkgconfig files
in $(libdir)/pkgconfig on linux and $(prefix)/libdata/pkgconfig on
FreeBSD, instead of /usr/share/pkgconfig, as the more correct location
for library .pc files.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes #10538
2020-06-30 17:10:41 +00:00
|
|
|
# incorporate the eight convenience libraries given above.
|
2020-11-15 04:35:31 +00:00
|
|
|
DISTLIBS = libuutil libzfs_core libzfs libzpool libzfsbootenv
|
|
|
|
SUBDIRS += $(DISTLIBS)
|
|
|
|
DISTLIBS += libnvpair
|
|
|
|
|
|
|
|
# An ABI is stored for each of these libraries. Note that libzpool.so
|
|
|
|
# is only linked against by ztest and zdb and no stable ABI is provided.
|
|
|
|
ABILIBS = libnvpair libuutil libzfs_core libzfs libzfsbootenv
|
|
|
|
|
2021-01-22 20:54:34 +00:00
|
|
|
PHONY = checkabi storeabi cppcheck
|
2020-11-15 04:35:31 +00:00
|
|
|
checkabi: $(ABILIBS)
|
|
|
|
set -e ; for dir in $(ABILIBS) ; do \
|
|
|
|
$(MAKE) -C $$dir checkabi ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
storeabi: $(ABILIBS)
|
|
|
|
set -e ; for dir in $(ABILIBS) ; do \
|
|
|
|
$(MAKE) -C $$dir storeabi ; \
|
|
|
|
done
|
2021-01-22 20:54:34 +00:00
|
|
|
|
|
|
|
cppcheck: $(CPPCHECKDIRS)
|
|
|
|
set -e ; for dir in $(CPPCHECKDIRS) ; do \
|
|
|
|
$(MAKE) -C $$dir cppcheck ; \
|
|
|
|
done
|