Skip to content

Commit 10b3c7f

Browse files
c0d3z3r0allanjudebehlendorfBrainSlayerKjeld Schouten-Lebbing
committed
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 <[email protected]> Co-authored-by: Brian Behlendorf <[email protected]> Co-authored-by: Sebastian Gottschall <[email protected]> Co-authored-by: Kjeld Schouten-Lebbing <[email protected]> Co-authored-by: Michael Niewöhner <[email protected]> Signed-off-by: Allan Jude <[email protected]> Signed-off-by: Allan Jude <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Sebastian Gottschall <[email protected]> Signed-off-by: Kjeld Schouten-Lebbing <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Closes #6247 Closes #9024 Closes #10277 Closes #10278
1 parent dc544ab commit 10b3c7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2666
-115
lines changed

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ CONTRIBUTORS:
182182
Keith M Wesolowski <[email protected]>
183183
Kevin Tanguy <[email protected]>
184184
KireinaHoro <[email protected]>
185+
Kjeld Schouten-Lebbing <[email protected]>
185186
Kohsuke Kawaguchi <[email protected]>
186187
Kyle Blatter <[email protected]>
187188
Kyle Fuller <[email protected]>
@@ -210,6 +211,7 @@ CONTRIBUTORS:
210211
Michael Gebetsroither <[email protected]>
211212
Michael Kjorling <[email protected]>
212213
Michael Martin <[email protected]>
214+
Michael Niewöhner <[email protected]>
213215
Mike Gerdts <[email protected]>
214216
Mike Harsch <[email protected]>
215217
Mike Leddy <[email protected]>
@@ -258,6 +260,7 @@ CONTRIBUTORS:
258260
Saso Kiselkov <[email protected]>
259261
Scot W. Stevenson <[email protected]>
260262
Sean Eric Fagan <[email protected]>
263+
Sebastian Gottschall <[email protected]>
261264
Sen Haerens <[email protected]>
262265
Serapheim Dimitropoulos <[email protected]>
263266
Seth Forshee <[email protected]>

cmd/dbufstat/dbufstat.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def get_compstring(c):
343343
"ZIO_COMPRESS_GZIP_6", "ZIO_COMPRESS_GZIP_7",
344344
"ZIO_COMPRESS_GZIP_8", "ZIO_COMPRESS_GZIP_9",
345345
"ZIO_COMPRESS_ZLE", "ZIO_COMPRESS_LZ4",
346-
"ZIO_COMPRESS_FUNCTION"]
346+
"ZIO_COMPRESS_ZSTD", "ZIO_COMPRESS_FUNCTION"]
347347

348348
# If "-rr" option is used, don't convert to string representation
349349
if raw > 1:

cmd/zdb/zdb.c

Lines changed: 96 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
* Copyright (c) 2017, 2018 Lawrence Livermore National Security, LLC.
2828
* Copyright (c) 2015, 2017, Intel Corporation.
2929
* Copyright (c) 2020 Datto Inc.
30+
* Copyright (c) 2020, The FreeBSD Foundation [1]
31+
*
32+
* [1] Portions of this software were developed by Allan Jude
33+
* under sponsorship from the FreeBSD Foundation.
3034
*/
3135

3236
#include <stdio.h>
@@ -71,6 +75,7 @@
7175
#include <sys/dsl_scan.h>
7276
#include <sys/btree.h>
7377
#include <zfs_comutil.h>
78+
#include <sys/zstd/zstd.h>
7479

7580
#include <libnvpair.h>
7681
#include <libzutil.h>
@@ -834,6 +839,7 @@ usage(void)
834839
"work with dataset)\n");
835840
(void) fprintf(stderr, " -Y attempt all reconstruction "
836841
"combinations for split blocks\n");
842+
(void) fprintf(stderr, " -Z show ZSTD headers \n");
837843
(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
838844
"to make only that option verbose\n");
839845
(void) fprintf(stderr, "Default is to dump everything non-verbosely\n");
@@ -2134,6 +2140,65 @@ blkid2offset(const dnode_phys_t *dnp, const blkptr_t *bp,
21342140
dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT);
21352141
}
21362142

2143+
static void
2144+
snprintf_zstd_header(spa_t *spa, char *blkbuf, size_t buflen,
2145+
const blkptr_t *bp)
2146+
{
2147+
abd_t *pabd;
2148+
void *buf;
2149+
zio_t *zio;
2150+
zfs_zstdhdr_t zstd_hdr;
2151+
int error;
2152+
2153+
if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_ZSTD)
2154+
return;
2155+
2156+
if (BP_IS_HOLE(bp))
2157+
return;
2158+
2159+
if (BP_IS_EMBEDDED(bp)) {
2160+
buf = malloc(SPA_MAXBLOCKSIZE);
2161+
if (buf == NULL) {
2162+
(void) fprintf(stderr, "out of memory\n");
2163+
exit(1);
2164+
}
2165+
decode_embedded_bp_compressed(bp, buf);
2166+
memcpy(&zstd_hdr, buf, sizeof (zstd_hdr));
2167+
free(buf);
2168+
zstd_hdr.c_len = BE_32(zstd_hdr.c_len);
2169+
zstd_hdr.raw_version_level = BE_32(zstd_hdr.raw_version_level);
2170+
(void) snprintf(blkbuf + strlen(blkbuf),
2171+
buflen - strlen(blkbuf),
2172+
" ZSTD:size=%u:version=%u:level=%u:EMBEDDED",
2173+
zstd_hdr.c_len, zstd_hdr.version, zstd_hdr.level);
2174+
return;
2175+
}
2176+
2177+
pabd = abd_alloc_for_io(SPA_MAXBLOCKSIZE, B_FALSE);
2178+
zio = zio_root(spa, NULL, NULL, 0);
2179+
2180+
/* Decrypt but don't decompress so we can read the compression header */
2181+
zio_nowait(zio_read(zio, spa, bp, pabd, BP_GET_PSIZE(bp), NULL, NULL,
2182+
ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL | ZIO_FLAG_RAW_COMPRESS,
2183+
NULL));
2184+
error = zio_wait(zio);
2185+
if (error) {
2186+
(void) fprintf(stderr, "read failed: %d\n", error);
2187+
return;
2188+
}
2189+
buf = abd_borrow_buf_copy(pabd, BP_GET_LSIZE(bp));
2190+
memcpy(&zstd_hdr, buf, sizeof (zstd_hdr));
2191+
zstd_hdr.c_len = BE_32(zstd_hdr.c_len);
2192+
zstd_hdr.raw_version_level = BE_32(zstd_hdr.raw_version_level);
2193+
2194+
(void) snprintf(blkbuf + strlen(blkbuf),
2195+
buflen - strlen(blkbuf),
2196+
" ZSTD:size=%u:version=%u:level=%u:NORMAL",
2197+
zstd_hdr.c_len, zstd_hdr.version, zstd_hdr.level);
2198+
2199+
abd_return_buf_copy(pabd, buf, BP_GET_LSIZE(bp));
2200+
}
2201+
21372202
static void
21382203
snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp,
21392204
boolean_t bp_freed)
@@ -2198,7 +2263,7 @@ snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp,
21982263
}
21992264

22002265
static void
2201-
print_indirect(blkptr_t *bp, const zbookmark_phys_t *zb,
2266+
print_indirect(spa_t *spa, blkptr_t *bp, const zbookmark_phys_t *zb,
22022267
const dnode_phys_t *dnp)
22032268
{
22042269
char blkbuf[BP_SPRINTF_LEN];
@@ -2222,6 +2287,8 @@ print_indirect(blkptr_t *bp, const zbookmark_phys_t *zb,
22222287
}
22232288

22242289
snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp, B_FALSE);
2290+
if (dump_opt['Z'] && BP_GET_COMPRESS(bp) == ZIO_COMPRESS_ZSTD)
2291+
snprintf_zstd_header(spa, blkbuf, sizeof (blkbuf), bp);
22252292
(void) printf("%s\n", blkbuf);
22262293
}
22272294

@@ -2234,7 +2301,7 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp,
22342301
if (bp->blk_birth == 0)
22352302
return (0);
22362303

2237-
print_indirect(bp, zb, dnp);
2304+
print_indirect(spa, bp, zb, dnp);
22382305

22392306
if (BP_GET_LEVEL(bp) > 0 && !BP_IS_HOLE(bp)) {
22402307
arc_flags_t flags = ARC_FLAG_WAIT;
@@ -3310,7 +3377,25 @@ dump_object(objset_t *os, uint64_t object, int verbosity,
33103377
" (K=%s)", ZDB_CHECKSUM_NAME(doi.doi_checksum));
33113378
}
33123379

3313-
if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) {
3380+
if (doi.doi_compress == ZIO_COMPRESS_INHERIT &&
3381+
ZIO_COMPRESS_HASLEVEL(os->os_compress) && verbosity >= 6) {
3382+
const char *compname = NULL;
3383+
if (zfs_prop_index_to_string(ZFS_PROP_COMPRESSION,
3384+
ZIO_COMPRESS_RAW(os->os_compress, os->os_complevel),
3385+
&compname) == 0) {
3386+
(void) snprintf(aux + strlen(aux),
3387+
sizeof (aux) - strlen(aux), " (Z=inherit=%s)",
3388+
compname);
3389+
} else {
3390+
(void) snprintf(aux + strlen(aux),
3391+
sizeof (aux) - strlen(aux),
3392+
" (Z=inherit=%s-unknown)",
3393+
ZDB_COMPRESS_NAME(os->os_compress));
3394+
}
3395+
} else if (doi.doi_compress == ZIO_COMPRESS_INHERIT && verbosity >= 6) {
3396+
(void) snprintf(aux + strlen(aux), sizeof (aux) - strlen(aux),
3397+
" (Z=inherit=%s)", ZDB_COMPRESS_NAME(os->os_compress));
3398+
} else if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) {
33143399
(void) snprintf(aux + strlen(aux), sizeof (aux) - strlen(aux),
33153400
" (Z=%s)", ZDB_COMPRESS_NAME(doi.doi_compress));
33163401
}
@@ -4093,6 +4178,8 @@ dump_l2arc_log_entries(uint64_t log_entries,
40934178
(u_longlong_t)L2BLK_GET_PSIZE((&le[j])->le_prop));
40944179
(void) printf("|\t\t\t\tcompr: %llu\n",
40954180
(u_longlong_t)L2BLK_GET_COMPRESS((&le[j])->le_prop));
4181+
(void) printf("|\t\t\t\tcomplevel: %llu\n",
4182+
(u_longlong_t)(&le[j])->le_complevel);
40964183
(void) printf("|\t\t\t\ttype: %llu\n",
40974184
(u_longlong_t)L2BLK_GET_TYPE((&le[j])->le_prop));
40984185
(void) printf("|\t\t\t\tprotected: %llu\n",
@@ -4186,16 +4273,14 @@ dump_l2arc_log_blocks(int fd, l2arc_dev_hdr_phys_t l2dhdr,
41864273
switch (L2BLK_GET_COMPRESS((&lbps[0])->lbp_prop)) {
41874274
case ZIO_COMPRESS_OFF:
41884275
break;
4189-
case ZIO_COMPRESS_LZ4:
4276+
default:
41904277
abd = abd_alloc_for_io(asize, B_TRUE);
41914278
abd_copy_from_buf_off(abd, &this_lb, 0, asize);
41924279
zio_decompress_data(L2BLK_GET_COMPRESS(
41934280
(&lbps[0])->lbp_prop), abd, &this_lb,
4194-
asize, sizeof (this_lb));
4281+
asize, sizeof (this_lb), NULL);
41954282
abd_free(abd);
41964283
break;
4197-
default:
4198-
break;
41994284
}
42004285

42014286
if (this_lb.lb_magic == BSWAP_64(L2ARC_LOG_BLK_MAGIC))
@@ -7684,9 +7769,9 @@ zdb_decompress_block(abd_t *pabd, void *buf, void *lbuf, uint64_t lsize,
76847769
VERIFY0(random_get_pseudo_bytes(lbuf2, lsize));
76857770

76867771
if (zio_decompress_data(*cfuncp, pabd,
7687-
lbuf, psize, lsize) == 0 &&
7772+
lbuf, psize, lsize, NULL) == 0 &&
76887773
zio_decompress_data(*cfuncp, pabd,
7689-
lbuf2, psize, lsize) == 0 &&
7774+
lbuf2, psize, lsize, NULL) == 0 &&
76907775
bcmp(lbuf, lbuf2, lsize) == 0)
76917776
break;
76927777
}
@@ -8078,7 +8163,7 @@ main(int argc, char **argv)
80788163
zfs_btree_verify_intensity = 3;
80798164

80808165
while ((c = getopt(argc, argv,
8081-
"AbcCdDeEFGhiI:klLmMo:Op:PqRsSt:uU:vVx:XYy")) != -1) {
8166+
"AbcCdDeEFGhiI:klLmMo:Op:PqRsSt:uU:vVx:XYyZ")) != -1) {
80828167
switch (c) {
80838168
case 'b':
80848169
case 'c':
@@ -8098,6 +8183,7 @@ main(int argc, char **argv)
80988183
case 'S':
80998184
case 'u':
81008185
case 'y':
8186+
case 'Z':
81018187
dump_opt[c]++;
81028188
dump_all = 0;
81038189
break;

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ AC_CONFIG_FILES([
136136
include/sys/fs/Makefile
137137
include/sys/lua/Makefile
138138
include/sys/sysevent/Makefile
139+
include/sys/zstd/Makefile
139140
lib/Makefile
140141
lib/libavl/Makefile
141142
lib/libefi/Makefile
@@ -163,6 +164,7 @@ AC_CONFIG_FILES([
163164
lib/libzfs_core/Makefile
164165
lib/libzfs_core/libzfs_core.pc
165166
lib/libzpool/Makefile
167+
lib/libzstd/Makefile
166168
lib/libzutil/Makefile
167169
man/Makefile
168170
man/man1/Makefile
@@ -180,6 +182,7 @@ AC_CONFIG_FILES([
180182
module/unicode/Makefile
181183
module/zcommon/Makefile
182184
module/zfs/Makefile
185+
module/zstd/Makefile
183186
rpm/Makefile
184187
rpm/generic/Makefile
185188
rpm/generic/zfs-dkms.spec

include/sys/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SUBDIRS = fm fs crypto lua sysevent
1+
SUBDIRS = fm fs crypto lua sysevent zstd
22

33
COMMON_H = \
44
abd.h \

include/sys/arc.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
2323
* Copyright (c) 2012, 2016 by Delphix. All rights reserved.
2424
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25+
* Copyright (c) 2019, Allan Jude
26+
* Copyright (c) 2019, Klara Inc.
2527
*/
2628

2729
#ifndef _SYS_ARC_H
@@ -252,18 +254,20 @@ void arc_convert_to_raw(arc_buf_t *buf, uint64_t dsobj, boolean_t byteorder,
252254
arc_buf_t *arc_alloc_buf(spa_t *spa, void *tag, arc_buf_contents_t type,
253255
int32_t size);
254256
arc_buf_t *arc_alloc_compressed_buf(spa_t *spa, void *tag,
255-
uint64_t psize, uint64_t lsize, enum zio_compress compression_type);
257+
uint64_t psize, uint64_t lsize, enum zio_compress compression_type,
258+
uint8_t complevel);
256259
arc_buf_t *arc_alloc_raw_buf(spa_t *spa, void *tag, uint64_t dsobj,
257260
boolean_t byteorder, const uint8_t *salt, const uint8_t *iv,
258261
const uint8_t *mac, dmu_object_type_t ot, uint64_t psize, uint64_t lsize,
259-
enum zio_compress compression_type);
262+
enum zio_compress compression_type, uint8_t complevel);
263+
uint8_t arc_get_complevel(arc_buf_t *buf);
260264
arc_buf_t *arc_loan_buf(spa_t *spa, boolean_t is_metadata, int size);
261265
arc_buf_t *arc_loan_compressed_buf(spa_t *spa, uint64_t psize, uint64_t lsize,
262-
enum zio_compress compression_type);
266+
enum zio_compress compression_type, uint8_t complevel);
263267
arc_buf_t *arc_loan_raw_buf(spa_t *spa, uint64_t dsobj, boolean_t byteorder,
264268
const uint8_t *salt, const uint8_t *iv, const uint8_t *mac,
265269
dmu_object_type_t ot, uint64_t psize, uint64_t lsize,
266-
enum zio_compress compression_type);
270+
enum zio_compress compression_type, uint8_t complevel);
267271
void arc_return_buf(arc_buf_t *buf, void *tag);
268272
void arc_loan_inuse_buf(arc_buf_t *buf, void *tag);
269273
void arc_buf_destroy(arc_buf_t *buf, void *tag);

include/sys/arc_impl.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,13 @@ typedef struct l2arc_log_ent_phys {
269269
*/
270270
uint64_t le_prop;
271271
uint64_t le_daddr; /* buf location on l2dev */
272+
uint64_t le_complevel;
272273
/*
273274
* We pad the size of each entry to a power of 2 so that the size of
274275
* l2arc_log_blk_phys_t is power-of-2 aligned with SPA_MINBLOCKSHIFT,
275276
* because of the L2ARC_SET_*SIZE macros.
276277
*/
277-
const uint64_t le_pad[3]; /* pad to 64 bytes */
278+
const uint64_t le_pad[2]; /* pad to 64 bytes */
278279
} l2arc_log_ent_phys_t;
279280

280281
#define L2ARC_LOG_BLK_MAX_ENTRIES (1022)
@@ -460,6 +461,9 @@ struct arc_buf_hdr {
460461
uint64_t b_birth;
461462

462463
arc_buf_contents_t b_type;
464+
uint8_t b_complevel;
465+
uint8_t b_reserved1; /* used for 4 byte alignment */
466+
uint16_t b_reserved2; /* used for 4 byte alignment */
463467
arc_buf_hdr_t *b_hash_next;
464468
arc_flags_t b_flags;
465469

include/sys/dmu_objset.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct objset {
118118
uint64_t os_dnodesize; /* default dnode size for new objects */
119119
enum zio_checksum os_checksum;
120120
enum zio_compress os_compress;
121+
uint8_t os_complevel;
121122
uint8_t os_copies;
122123
enum zio_checksum os_dedup_checksum;
123124
boolean_t os_dedup_verify;

include/sys/dsl_dataset.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ int dsl_dataset_set_refquota(const char *dsname, zprop_source_t source,
435435
uint64_t quota);
436436
int dsl_dataset_set_refreservation(const char *dsname, zprop_source_t source,
437437
uint64_t reservation);
438+
int dsl_dataset_set_compression(const char *dsname, zprop_source_t source,
439+
uint64_t compression);
438440

439441
boolean_t dsl_dataset_is_before(dsl_dataset_t *later, dsl_dataset_t *earlier,
440442
uint64_t earlier_txg);

include/sys/spa.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
* Copyright 2017 Joyent, Inc.
2929
* Copyright (c) 2017, 2019, Datto Inc. All rights reserved.
3030
* Copyright (c) 2017, Intel Corporation.
31+
* Copyright (c) 2019, Allan Jude
32+
* Copyright (c) 2019, Klara Inc.
3133
*/
3234

3335
#ifndef _SYS_SPA_H
@@ -120,6 +122,7 @@ struct dsl_crypto_params;
120122

121123
#define SPA_COMPRESSBITS 7
122124
#define SPA_VDEVBITS 24
125+
#define SPA_COMPRESSMASK ((1U << SPA_COMPRESSBITS) - 1)
123126

124127
/*
125128
* All SPA data is represented by 128-bit data virtual addresses (DVAs).

include/sys/zfs_context.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,12 @@ extern int kmem_cache_reap_active(void);
748748

749749
#define ____cacheline_aligned
750750

751+
/*
752+
* Kernel modules
753+
*/
754+
#define __init
755+
#define __exit
756+
751757
#endif /* _KERNEL */
752758

753759
#ifdef __cplusplus

include/sys/zfs_ioctl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ typedef enum drr_headertype {
105105
#define DMU_BACKUP_FEATURE_COMPRESSED (1 << 22)
106106
#define DMU_BACKUP_FEATURE_LARGE_DNODE (1 << 23)
107107
#define DMU_BACKUP_FEATURE_RAW (1 << 24)
108-
/* flag #25 is reserved for the ZSTD compression feature */
108+
#define DMU_BACKUP_FEATURE_ZSTD (1 << 25)
109109
#define DMU_BACKUP_FEATURE_HOLDS (1 << 26)
110110
/*
111111
* The SWITCH_TO_LARGE_BLOCKS feature indicates that we can receive
@@ -132,7 +132,8 @@ typedef enum drr_headertype {
132132
DMU_BACKUP_FEATURE_RESUMING | DMU_BACKUP_FEATURE_LARGE_BLOCKS | \
133133
DMU_BACKUP_FEATURE_COMPRESSED | DMU_BACKUP_FEATURE_LARGE_DNODE | \
134134
DMU_BACKUP_FEATURE_RAW | DMU_BACKUP_FEATURE_HOLDS | \
135-
DMU_BACKUP_FEATURE_REDACTED | DMU_BACKUP_FEATURE_SWITCH_TO_LARGE_BLOCKS)
135+
DMU_BACKUP_FEATURE_REDACTED | DMU_BACKUP_FEATURE_SWITCH_TO_LARGE_BLOCKS | \
136+
DMU_BACKUP_FEATURE_ZSTD)
136137

137138
/* Are all features in the given flag word currently supported? */
138139
#define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK))

0 commit comments

Comments
 (0)