Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ cstyle:
! -name 'zfs_config.*' ! -name '*.mod.c' \
! -name 'opt_global.h' ! -name '*_if*.h' \
! -name 'zstd_compat_wrapper.h' \
! -path './module/zstd/zstd-in.c' \
! -path './module/zstd/lib/*' \
! -path './include/sys/lua/*' \
! -path './module/lua/l*.[ch]' \
Expand Down
6 changes: 6 additions & 0 deletions lib/libzstd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ nodist_libzstd_la_SOURCES = \
module/zstd/lib/compress/zstd_lazy.c \
module/zstd/lib/compress/zstd_ldm.c \
module/zstd/lib/compress/zstd_opt.c \
module/zstd/lib/compress/zstd_preSplit.c \
module/zstd/lib/decompress/huf_decompress.c \
module/zstd/lib/decompress/zstd_ddict.c \
module/zstd/lib/decompress/zstd_decompress.c \
module/zstd/lib/decompress/zstd_decompress_block.c \
module/zstd/zfs_zstd.c

if TARGET_CPU_X86_64
nodist_libzstd_la_SOURCES += \
module/zstd/lib/decompress/huf_decompress_amd64.S
endif

libzstd_la_CFLAGS += -include $(top_srcdir)/module/zstd/include/zstd_compat_wrapper.h -fno-tree-vectorize -Wp,-w $(AM_CFLAGS)
10 changes: 10 additions & 0 deletions module/Kbuild.in
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ ZFS_ZSTD_FLAGS += -U__BMI__
# Quiet warnings about frame size due to unused code in unmodified zstd lib
ZFS_ZSTD_FLAGS += -Wframe-larger-than=20480

# Disable assembly for kernel compatibility
ZFS_ZSTD_FLAGS += -DZSTD_DISABLE_ASM

# Disable intrinsics for EL10 x86_64-v3 baseline
ZFS_ZSTD_FLAGS += -DZSTD_NO_INTRINSICS

# Disable tracing for kernel builds
ZFS_ZSTD_FLAGS += -DZSTD_TRACE=0

ZSTD_OBJS := \
zfs_zstd.o \
zstd_sparc.o
Expand All @@ -287,6 +296,7 @@ ZSTD_UPSTREAM_OBJS := \
lib/compress/zstd_lazy.o \
lib/compress/zstd_ldm.o \
lib/compress/zstd_opt.o \
lib/compress/zstd_preSplit.o \
lib/decompress/huf_decompress.o \
lib/decompress/zstd_ddict.o \
lib/decompress/zstd_decompress.o \
Expand Down
4 changes: 2 additions & 2 deletions module/Makefile.bsd
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ SRCS+= entropy_common.c \
error_private.c \
fse_decompress.c \
pool.c \
xxhash.c \
zstd_common.c \

#zstd/compress
Expand All @@ -404,7 +403,8 @@ SRCS+= fse_compress.c \
zstd_fast.c \
zstd_lazy.c \
zstd_ldm.c \
zstd_opt.c
zstd_opt.c \
zstd_preSplit.c

#zstd/decompress
SRCS+= huf_decompress.c \
Expand Down
44 changes: 31 additions & 13 deletions module/zstd/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# ZSTD-On-ZFS Library Manual
# Zstd-On-ZFS Library Manual

## Introduction

This subtree contains the ZSTD library used in ZFS. It is heavily cut-down by
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.
library, besides upgrading to a newer Zstd release.

Tree structure:

Expand All @@ -14,25 +14,43 @@ Tree structure:
* `zstd-in.c` is our template file for generating the single-file library
* `include/`: 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.
future. Thus we keep them private to Zstd.

## Updating ZSTD
## Zstd update policy

To update ZSTD the following steps need to be taken:
Since the exact compressed byte stream may change between Zstd versions, updates
should follow this policy:

1. Grab the latest release of [ZSTD](https://github.com/facebook/zstd/releases).
1. Zstd may be updated, as needed, after a new .0 release is tagged.
2. Critical patches may be applied up until the next release freeze,
_potentially_ even updating to a newer upstream version.
3. The Zstd version will not be upgraded within a major release.
4. Multiple Zstd versions are not supported concurrently within a release.
5. The library import commit must be a clean, unmodified upstream import. Any
OpenZFS-specific integration or local adjustments go into follow-up commits.
6. Release notes should highlight Zstd updates and any expected impact (e.g.
changes in compression ratio/performance, and differences in compressed byte
streams which may affect deduplication or NOP writes).

## Updating Zstd

To update Zstd the following steps need to be taken:

1. Grab the latest release of [Zstd](https://github.com/facebook/zstd/releases).
2. Copy the files output by the following script to `module/zstd/lib/`:
`grep include [path to zstd]/contrib/single_file_libs/zstd-in.c | awk '{ print $2 }'`
```
grep include [path to zstd]/build/single_file_libs/zstd-in.c | awk '{ print $2 }'
```
3. Remove debug.c, threading.c, and zstdmt_compress.c.
4. Update Makefiles with resulting file lists.
5. Follow symbol renaming notes in `include/zstd_compat_wrapper.h`
5. Follow symbol renaming notes in `include/zstd_compat_wrapper.h`.

## Altering ZSTD and breaking changes
## Altering Zstd and breaking changes

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
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
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.
Loading
Loading