module/zstd/README.md
This subtree contains the Zstd library used in ZFS. It is heavily cut-down by dropping any unneeded files, and combined into a single file, but otherwise is intentionally unmodified. Please do not alter the file containing the zstd library, besides upgrading to a newer Zstd release.
Tree structure:
zfs_zstd.c are the actual zfs kernel module hooks.lib/ contains the unmodified version of the Zstandard libraryzstd-in.c is our template file for generating the single-file libraryinclude/: This directory contains supplemental includes for platform
compatibility, which are not expected to be used by ZFS elsewhere in the
future. Thus we keep them private to Zstd.Since the exact compressed byte stream may change between Zstd versions, updates should follow this policy:
To update Zstd the following steps need to be taken:
module/zstd/lib/:
grep include [path to zstd]/build/single_file_libs/zstd-in.c | awk '{ print $2 }'
include/zstd_compat_wrapper.h.If Zstd made changes that break compatibility or you need to make breaking changes to the way we handle Zstd, it is required to maintain backwards compatibility.
We already save the Zstd version number within the block header to be used to add future compatibility checks and/or fixes. However, currently it is not actually used in such a way.