Page MenuHomeFreeBSD

D35750.id107901.diff
No OneTemporary

D35750.id107901.diff

Index: stand/libsa/zfs/Makefile.inc
===================================================================
--- stand/libsa/zfs/Makefile.inc
+++ stand/libsa/zfs/Makefile.inc
@@ -3,11 +3,13 @@
.PATH: ${ZFSSRC}
.PATH: ${SYSDIR}/crypto/skein
.PATH: ${ZFSOSSRC}/spl
+.PATH: ${OZFS}/module/zstd
.PATH: ${OZFS}/module/zstd/lib/common
.PATH: ${OZFS}/module/zstd/lib/compress
.PATH: ${OZFS}/module/zstd/lib/decompress
+.PATH: ${OZFS}/module/icp/algs/blake3
ZFSSRC= zfs.c nvlist.c skein.c skein_block.c list.c
-ZFSSRC+= zstd_shim.c
+ZFSSRC+= zfs_zstd.c blake3.c blake3_generic.c blake3_impl.c
ZFSSRC+= entropy_common.c error_private.c
ZFSSRC+= fse_compress.c fse_decompress.c hist.c
ZFSSRC+= huf_compress.c huf_decompress.c pool.c xxhash.c
@@ -32,8 +34,11 @@
CFLAGS.$i+= -include ${ZFSOSINC}/spl/sys/ccompile.h
.endfor
+CFLAGS_EARLY.blake3.c+= ${ZFS_EARLY}
+CFLAGS_EARLY.blake3_generic.c+= ${ZFS_EARLY}
+CFLAGS_EARLY.blake3_impl.c+= ${ZFS_EARLY}
CFLAGS_EARLY.list.c+= ${ZFS_EARLY}
-CFLAGS_EARLY.zstd_shim.c+= ${ZFS_EARLY}
+CFLAGS_EARLY.zfs_zstd.c+= ${ZFS_EARLY}
# Can't use the early flags because there's two conflicting definitions of boolean_t in
# the zfs code that need to be unified.
@@ -84,7 +89,7 @@
CFLAGS.zstd_decompress.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
CFLAGS.zstd_decompress_block.c= -U__BMI__
CFLAGS.zstd_decompress_block.c+= ${NO_WBITWISE_INSTEAD_OF_LOGICAL}
-CFLAGS.zstd_shim.c+= -DIN_BASE -DIN_LIBSA -I${OZFS}/include
+CFLAGS.zfs_zstd.c+= -DIN_BASE -DIN_LIBSA
# Do not unroll skein loops, reduce code size
CFLAGS.skein_block.c+= -DSKEIN_LOOP=111
Index: stand/libsa/zfs/zfsimpl.c
===================================================================
--- stand/libsa/zfs/zfsimpl.c
+++ stand/libsa/zfs/zfsimpl.c
@@ -140,6 +140,7 @@
"org.freebsd:zstd_compress",
"com.delphix:bookmark_written",
"com.delphix:head_errlog",
+ "org.openzfs:blake3",
NULL
};
Index: stand/libsa/zfs/zstd_shim.c
===================================================================
--- stand/libsa/zfs/zstd_shim.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 2020 M. Warner Losh <imp@FreeBSD.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Small amount of shim code needed to get zfs_zstd.c to compile. These items
- * here should all be defined in the SPL or as part of libsa somewhere, but
- * aren't for reasons that haven't been tracked down yet. Ideally, they would
- * all go away and we'd compile zfs_zstd.c directly. Based on an original by
- * Matt Macey, but only the #include remains untouched from that.
- */
-
-#define ZFS_MODULE_PARAM_ARGS void
-typedef int boolean_t; /* This one may be tough to get rid of */
-
-/* TODO: openzfs/include/sys/uio_impl.h must not be included */
-#ifndef _SYS_UIO_IMPL_H
-#define _SYS_UIO_IMPL_H
-#endif
-
-#include <contrib/openzfs/module/zstd/zfs_zstd.c>
Index: sys/cddl/boot/zfs/zfsimpl.h
===================================================================
--- sys/cddl/boot/zfs/zfsimpl.h
+++ sys/cddl/boot/zfs/zfsimpl.h
@@ -602,6 +602,7 @@
ZIO_CHECKSUM_SHA512,
ZIO_CHECKSUM_SKEIN,
ZIO_CHECKSUM_EDONR,
+ ZIO_CHECKSUM_BLAKE3,
ZIO_CHECKSUM_FUNCTIONS
};
Index: sys/cddl/boot/zfs/zfssubr.c
===================================================================
--- sys/cddl/boot/zfs/zfssubr.c
+++ sys/cddl/boot/zfs/zfssubr.c
@@ -102,6 +102,7 @@
#include "blkptr.c"
#include "fletcher.c"
+#include "blake3_zfs.c"
#include "sha256.c"
#include "skein_zfs.c"
@@ -140,7 +141,11 @@
ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "skein"},
/* no edonr for now */
{{NULL, NULL}, NULL, NULL, ZCHECKSUM_FLAG_METADATA |
- ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "edonr"}
+ ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "edonr"},
+ {{zio_checksum_blake3_native, zio_checksum_blake3_byteswap},
+ zio_checksum_blake3_tmpl_init, zio_checksum_blake3_tmpl_free,
+ ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_DEDUP |
+ ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "blake3"}
};
/*
Index: sys/contrib/openzfs/include/os/freebsd/spl/sys/types.h
===================================================================
--- sys/contrib/openzfs/include/os/freebsd/spl/sys/types.h
+++ sys/contrib/openzfs/include/os/freebsd/spl/sys/types.h
@@ -78,9 +78,6 @@
typedef mode_t o_mode_t;
typedef uint64_t pgcnt_t;
-#define B_FALSE 0
-#define B_TRUE 1
-
typedef short index_t;
typedef off_t offset_t;
#ifndef _PTRDIFF_T_DECLARED
@@ -90,14 +87,11 @@
typedef int64_t rlim64_t;
typedef int major_t;
-#else
-#ifdef NEED_SOLARIS_BOOLEAN
#if defined(__XOPEN_OR_POSIX)
typedef enum { _B_FALSE, _B_TRUE } boolean_t;
#else
typedef enum { B_FALSE, B_TRUE } boolean_t;
#endif /* defined(__XOPEN_OR_POSIX) */
-#endif
typedef u_longlong_t u_offset_t;
typedef u_longlong_t len_t;
Index: sys/contrib/openzfs/include/os/freebsd/spl/sys/zfs_context.h
===================================================================
--- /dev/null
+++ sys/contrib/openzfs/include/os/freebsd/spl/sys/zfs_context.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2022, Netflix, Inc
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+/* TODO: openzfs/include/sys/uio_impl.h must not be included */
+#ifndef _SYS_UIO_IMPL_H
+#define _SYS_UIO_IMPL_H
+#endif
+
+#include_next <sys/zfs_context.h>
+
+#define ZFS_MODULE_PARAM_ARGS void
+
+/* Not sure why I need these, but including the canonical stand.h fails */
+void *memcpy(void *dst, const void *src, size_t len);
+void *memset(void *dest, int c, size_t len);
+void *memmem(const void *big, size_t big_len, const void *little,
+ size_t little_len);
+
Index: sys/contrib/openzfs/include/sys/blake3.h
===================================================================
--- sys/contrib/openzfs/include/sys/blake3.h
+++ sys/contrib/openzfs/include/sys/blake3.h
@@ -28,7 +28,7 @@
#ifndef BLAKE3_H
#define BLAKE3_H
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
#include <sys/types.h>
#else
#include <stdint.h>
Index: sys/contrib/openzfs/include/sys/zfs_context.h
===================================================================
--- sys/contrib/openzfs/include/sys/zfs_context.h
+++ sys/contrib/openzfs/include/sys/zfs_context.h
@@ -42,8 +42,8 @@
*/
#if defined(__KERNEL__) || defined(_STANDALONE)
#include <sys/types.h>
-#include <sys/atomic.h>
#include <sys/sysmacros.h>
+#include <sys/atomic.h>
#include <sys/vmsystm.h>
#include <sys/condvar.h>
#include <sys/cmn_err.h>

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 3:54 AM (19 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14669866
Default Alt Text
D35750.id107901.diff (7 KB)

Event Timeline