Enable edonr in FreeBSD

The code is integrated, builds fine, runs fine, there's not really
any reason not to.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12735
This commit is contained in:
Rich Ercolani 2021-11-16 14:40:10 -05:00 committed by GitHub
parent b8dcfb2c9f
commit 269b5dadcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 14 additions and 57 deletions

View File

@ -88,9 +88,7 @@ enum zio_checksum {
ZIO_CHECKSUM_NOPARITY, ZIO_CHECKSUM_NOPARITY,
ZIO_CHECKSUM_SHA512, ZIO_CHECKSUM_SHA512,
ZIO_CHECKSUM_SKEIN, ZIO_CHECKSUM_SKEIN,
#if !defined(__FreeBSD__)
ZIO_CHECKSUM_EDONR, ZIO_CHECKSUM_EDONR,
#endif
ZIO_CHECKSUM_FUNCTIONS ZIO_CHECKSUM_FUNCTIONS
}; };

View File

@ -771,10 +771,6 @@ The
and and
.Sy edonr .Sy edonr
checksum algorithms require enabling the appropriate features on the pool. checksum algorithms require enabling the appropriate features on the pool.
.Fx
does not support the
.Sy edonr
algorithm.
.Pp .Pp
Please see Please see
.Xr zpool-features 7 .Xr zpool-features 7

View File

@ -436,10 +436,6 @@ in ZFS, which means that the checksum is pre-seeded with a secret
to be checksummed. to be checksummed.
Thus the produced checksums are unique to a given pool, Thus the produced checksums are unique to a given pool,
preventing hash collision attacks on systems with dedup. preventing hash collision attacks on systems with dedup.
.Pp
.checksum-spiel edonr
.Pp
.Fx does not support the Sy edonr No feature.
. .
.feature com.delphix embedded_data no .feature com.delphix embedded_data no
This feature improves the performance and compression ratio of This feature improves the performance and compression ratio of

View File

@ -12,6 +12,7 @@ KMOD= openzfs
.PATH: ${SRCDIR}/avl \ .PATH: ${SRCDIR}/avl \
${SRCDIR}/lua \ ${SRCDIR}/lua \
${SRCDIR}/nvpair \ ${SRCDIR}/nvpair \
${SRCDIR}/icp/algs/edonr \
${SRCDIR}/os/freebsd/spl \ ${SRCDIR}/os/freebsd/spl \
${SRCDIR}/os/freebsd/zfs \ ${SRCDIR}/os/freebsd/zfs \
${SRCDIR}/unicode \ ${SRCDIR}/unicode \
@ -73,6 +74,9 @@ SRCS= vnode_if.h device_if.h bus_if.h
# avl # avl
SRCS+= avl.c SRCS+= avl.c
# icp
SRCS+= edonr.c
#lua #lua
SRCS+= lapi.c \ SRCS+= lapi.c \
lauxlib.c \ lauxlib.c \
@ -219,6 +223,7 @@ SRCS+= abd.c \
dsl_scan.c \ dsl_scan.c \
dsl_synctask.c \ dsl_synctask.c \
dsl_userhold.c \ dsl_userhold.c \
edonr_zfs.c \
fm.c \ fm.c \
gzip.c \ gzip.c \
lzjb.c \ lzjb.c \
@ -345,6 +350,7 @@ CFLAGS.dmu_traverse.c= -Wno-cast-qual
CFLAGS.dsl_dir.c= -Wno-cast-qual CFLAGS.dsl_dir.c= -Wno-cast-qual
CFLAGS.dsl_deadlist.c= -Wno-cast-qual CFLAGS.dsl_deadlist.c= -Wno-cast-qual
CFLAGS.dsl_prop.c= -Wno-cast-qual CFLAGS.dsl_prop.c= -Wno-cast-qual
CFLAGS.edonr.c=-Wno-cast-qual
CFLAGS.fm.c= -Wno-cast-qual CFLAGS.fm.c= -Wno-cast-qual
CFLAGS.lz4.c= -Wno-cast-qual CFLAGS.lz4.c= -Wno-cast-qual
CFLAGS.spa.c= -Wno-cast-qual CFLAGS.spa.c= -Wno-cast-qual

View File

@ -227,12 +227,8 @@ zfs_mod_supported_feature(const char *name)
* tree, but this has not been done yet. Therefore, we return * tree, but this has not been done yet. Therefore, we return
* that all features except edonr are supported. * that all features except edonr are supported.
*/ */
#if defined(__FreeBSD__)
if (strcmp(name, "org.illumos:edonr") == 0) #if defined(_KERNEL) || defined(LIB_ZPOOL_BUILD) || defined(__FreeBSD__)
return (B_FALSE);
else
return (B_TRUE);
#elif defined(_KERNEL) || defined(LIB_ZPOOL_BUILD)
return (B_TRUE); return (B_TRUE);
#else #else
return (zfs_mod_supported(ZFS_SYSFS_POOL_FEATURES, name)); return (zfs_mod_supported(ZFS_SYSFS_POOL_FEATURES, name));

View File

@ -83,10 +83,7 @@ zfs_prop_init(void)
{ "noparity", ZIO_CHECKSUM_NOPARITY }, { "noparity", ZIO_CHECKSUM_NOPARITY },
{ "sha512", ZIO_CHECKSUM_SHA512 }, { "sha512", ZIO_CHECKSUM_SHA512 },
{ "skein", ZIO_CHECKSUM_SKEIN }, { "skein", ZIO_CHECKSUM_SKEIN },
#if !defined(__FreeBSD__)
{ "edonr", ZIO_CHECKSUM_EDONR }, { "edonr", ZIO_CHECKSUM_EDONR },
#endif
{ NULL } { NULL }
}; };
@ -103,11 +100,8 @@ zfs_prop_init(void)
{ "skein", ZIO_CHECKSUM_SKEIN }, { "skein", ZIO_CHECKSUM_SKEIN },
{ "skein,verify", { "skein,verify",
ZIO_CHECKSUM_SKEIN | ZIO_CHECKSUM_VERIFY }, ZIO_CHECKSUM_SKEIN | ZIO_CHECKSUM_VERIFY },
#if !defined(__FreeBSD__)
{ "edonr,verify", { "edonr,verify",
ZIO_CHECKSUM_EDONR | ZIO_CHECKSUM_VERIFY }, ZIO_CHECKSUM_EDONR | ZIO_CHECKSUM_VERIFY },
#endif
{ NULL } { NULL }
}; };
@ -396,21 +390,13 @@ zfs_prop_init(void)
zprop_register_index(ZFS_PROP_CHECKSUM, "checksum", zprop_register_index(ZFS_PROP_CHECKSUM, "checksum",
ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM |
ZFS_TYPE_VOLUME, ZFS_TYPE_VOLUME,
#if !defined(__FreeBSD__)
"on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein" "on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein"
" | edonr", " | edonr",
#else
"on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein",
#endif
"CHECKSUM", checksum_table); "CHECKSUM", checksum_table);
zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF, zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF,
PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
"on | off | verify | sha256[,verify] | sha512[,verify] | " "on | off | verify | sha256[,verify] | sha512[,verify] | "
#if !defined(__FreeBSD__)
"skein[,verify] | edonr,verify", "skein[,verify] | edonr,verify",
#else
"skein[,verify]",
#endif
"DEDUP", dedup_table); "DEDUP", dedup_table);
zprop_register_index(ZFS_PROP_COMPRESSION, "compression", zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
ZIO_COMPRESS_DEFAULT, PROP_INHERIT, ZIO_COMPRESS_DEFAULT, PROP_INHERIT,

View File

@ -191,12 +191,10 @@ zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
abd_checksum_skein_tmpl_init, abd_checksum_skein_tmpl_free, abd_checksum_skein_tmpl_init, abd_checksum_skein_tmpl_free,
ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_DEDUP | ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_DEDUP |
ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "skein"}, ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "skein"},
#if !defined(__FreeBSD__)
{{abd_checksum_edonr_native, abd_checksum_edonr_byteswap}, {{abd_checksum_edonr_native, abd_checksum_edonr_byteswap},
abd_checksum_edonr_tmpl_init, abd_checksum_edonr_tmpl_free, abd_checksum_edonr_tmpl_init, abd_checksum_edonr_tmpl_free,
ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_SALTED |
ZCHECKSUM_FLAG_NOPWRITE, "edonr"}, ZCHECKSUM_FLAG_NOPWRITE, "edonr"},
#endif
}; };
/* /*
@ -213,10 +211,8 @@ zio_checksum_to_feature(enum zio_checksum cksum)
return (SPA_FEATURE_SHA512); return (SPA_FEATURE_SHA512);
case ZIO_CHECKSUM_SKEIN: case ZIO_CHECKSUM_SKEIN:
return (SPA_FEATURE_SKEIN); return (SPA_FEATURE_SKEIN);
#if !defined(__FreeBSD__)
case ZIO_CHECKSUM_EDONR: case ZIO_CHECKSUM_EDONR:
return (SPA_FEATURE_EDONR); return (SPA_FEATURE_EDONR);
#endif
default: default:
return (SPA_FEATURE_NONE); return (SPA_FEATURE_NONE);
} }

View File

@ -109,7 +109,7 @@ tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit',
tags = ['functional', 'channel_program', 'synctask_core'] tags = ['functional', 'channel_program', 'synctask_core']
[tests/functional/checksum] [tests/functional/checksum]
tests = ['run_sha2_test', 'run_skein_test', 'filetest_001_pos', tests = ['run_edonr_test', 'run_sha2_test', 'run_skein_test', 'filetest_001_pos',
'filetest_002_pos'] 'filetest_002_pos']
tags = ['functional', 'checksum'] tags = ['functional', 'checksum']

View File

@ -38,10 +38,6 @@ tags = ['functional', 'atime']
tests = ['chattr_001_pos', 'chattr_002_neg'] tests = ['chattr_001_pos', 'chattr_002_neg']
tags = ['functional', 'chattr'] tags = ['functional', 'chattr']
[tests/functional/checksum:Linux]
tests = ['run_edonr_test']
tags = ['functional', 'checksum']
[tests/functional/cli_root/zfs:Linux] [tests/functional/cli_root/zfs:Linux]
tests = ['zfs_003_neg'] tests = ['zfs_003_neg']
tags = ['functional', 'cli_root', 'zfs'] tags = ['functional', 'cli_root', 'zfs']

View File

@ -21,13 +21,11 @@ dist_pkgdata_DATA = \
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum
pkgexec_PROGRAMS = \ pkgexec_PROGRAMS = \
edonr_test \
skein_test \ skein_test \
sha2_test sha2_test
skein_test_SOURCES = skein_test.c skein_test_SOURCES = skein_test.c
sha2_test_SOURCES = sha2_test.c sha2_test_SOURCES = sha2_test.c
if BUILD_LINUX
pkgexec_PROGRAMS += edonr_test
edonr_test_SOURCES = edonr_test.c edonr_test_SOURCES = edonr_test.c
endif

View File

@ -30,7 +30,4 @@
. $STF_SUITE/include/libtest.shlib . $STF_SUITE/include/libtest.shlib
set -A CHECKSUM_TYPES "fletcher2" "fletcher4" "sha256" "sha512" "skein" set -A CHECKSUM_TYPES "fletcher2" "fletcher4" "sha256" "sha512" "skein" "edonr"
if ! is_freebsd; then
CHECKSUM_TYPES+=("edonr")
fi

View File

@ -46,10 +46,7 @@
verify_runnable "both" verify_runnable "both"
set -A dataset "$TESTPOOL" "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTVOL" set -A dataset "$TESTPOOL" "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTVOL"
set -A values "on" "off" "fletcher2" "fletcher4" "sha256" "sha512" "skein" "noparity" set -A values "on" "off" "fletcher2" "fletcher4" "sha256" "sha512" "skein" "edonr" "noparity"
if is_linux; then
values+=("edonr")
fi
log_assert "Setting a valid checksum on a file system, volume," \ log_assert "Setting a valid checksum on a file system, volume," \
"it should be successful." "it should be successful."

View File

@ -72,6 +72,7 @@ typeset -a properties=(
"feature@large_blocks" "feature@large_blocks"
"feature@sha512" "feature@sha512"
"feature@skein" "feature@skein"
"feature@edonr"
"feature@device_removal" "feature@device_removal"
"feature@obsolete_counts" "feature@obsolete_counts"
"feature@zpool_checkpoint" "feature@zpool_checkpoint"
@ -97,10 +98,4 @@ if is_linux || is_freebsd; then
"feature@livelist" "feature@livelist"
"feature@zstd_compress" "feature@zstd_compress"
) )
fi fi
if ! is_freebsd; then
properties+=(
"feature@edonr"
)
fi