diff --git a/stand/libsa/zfs/Makefile.inc b/stand/libsa/zfs/Makefile.inc index 132d2abe63a6..7af42efa02dc 100644 --- a/stand/libsa/zfs/Makefile.inc +++ b/stand/libsa/zfs/Makefile.inc @@ -4,7 +4,11 @@ .PATH: ${SYSDIR}/crypto/skein .PATH: ${ZFSOSSRC}/spl .PATH: ${OZFS}/module/zstd/lib -ZFSSRC= zfs.c nvlist.c skein.c skein_block.c list.c zstd_shim.c zstd.c +ZFSSRC= zfs.c nvlist.c skein.c skein_block.c list.c +.if ${MACHINE_ARCH} != aarch64 +ZFSSRC+= zstd_shim.c zstd.c +CFLAGS+= -DHAS_ZSTD_ZFS +.endif SRCS+= ${ZFSSRC} CFLAGS+= -I${LDRSRC} diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index 0c2aa5ff3323..9d3e18f01382 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -42,7 +42,9 @@ __FBSDID("$FreeBSD$"); #include "zfsimpl.h" #include "zfssubr.c" +#ifdef HAS_ZSTD_ZFS extern int zstd_init(void); +#endif struct zfsmount { const spa_t *spa; @@ -130,7 +132,9 @@ static const char *features_for_read[] = { "com.delphix:device_removal", "com.delphix:obsolete_counts", "com.intel:allocation_classes", +#ifdef HAS_ZSTD_ZFS "org.freebsd:zstd_compress", +#endif NULL }; @@ -171,7 +175,9 @@ zfs_init(void) dnode_cache_buf = malloc(SPA_MAXBLOCKSIZE); zfs_init_crc(); +#ifdef HAS_ZSTD_ZFS zstd_init(); +#endif } static int diff --git a/sys/cddl/boot/zfs/zfssubr.c b/sys/cddl/boot/zfs/zfssubr.c index 79e6c4ebd9e1..dd22f268bd20 100644 --- a/sys/cddl/boot/zfs/zfssubr.c +++ b/sys/cddl/boot/zfs/zfssubr.c @@ -105,9 +105,10 @@ typedef struct zio_checksum_info { #include "sha256.c" #include "skein_zfs.c" +#ifdef HAS_ZSTD_ZFS extern int zfs_zstd_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n); - +#endif static zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { {{NULL, NULL}, NULL, NULL, 0, "inherit"}, @@ -183,7 +184,9 @@ static zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = { {NULL, NULL, 9, "gzip-9"}, {NULL, zle_decompress, 64, "zle"}, {NULL, lz4_decompress, 0, "lz4"}, +#ifdef HAS_ZSTD_ZFS {NULL, zfs_zstd_decompress, ZIO_ZSTD_LEVEL_DEFAULT, "zstd"} +#endif }; static void