Skip to content

Commit

Permalink
Enable edonr in FreeBSD
Browse files Browse the repository at this point in the history
The code is integrated, builds fine, runs fine, there's not really
any reason not to.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Tony Nguyen <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes openzfs#12735
  • Loading branch information
rincebrain committed Nov 16, 2021
1 parent b8dcfb2 commit 269b5da
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 57 deletions.
2 changes: 0 additions & 2 deletions include/sys/zio.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ enum zio_checksum {
ZIO_CHECKSUM_NOPARITY,
ZIO_CHECKSUM_SHA512,
ZIO_CHECKSUM_SKEIN,
#if !defined(__FreeBSD__)
ZIO_CHECKSUM_EDONR,
#endif
ZIO_CHECKSUM_FUNCTIONS
};

Expand Down
4 changes: 0 additions & 4 deletions man/man7/zfsprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,6 @@ The
and
.Sy edonr
checksum algorithms require enabling the appropriate features on the pool.
.Fx
does not support the
.Sy edonr
algorithm.
.Pp
Please see
.Xr zpool-features 7
Expand Down
4 changes: 0 additions & 4 deletions man/man7/zpool-features.7
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,6 @@ in ZFS, which means that the checksum is pre-seeded with a secret
to be checksummed.
Thus the produced checksums are unique to a given pool,
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
This feature improves the performance and compression ratio of
Expand Down
6 changes: 6 additions & 0 deletions module/Makefile.bsd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ KMOD= openzfs
.PATH: ${SRCDIR}/avl \
${SRCDIR}/lua \
${SRCDIR}/nvpair \
${SRCDIR}/icp/algs/edonr \
${SRCDIR}/os/freebsd/spl \
${SRCDIR}/os/freebsd/zfs \
${SRCDIR}/unicode \
Expand Down Expand Up @@ -73,6 +74,9 @@ SRCS= vnode_if.h device_if.h bus_if.h
# avl
SRCS+= avl.c

# icp
SRCS+= edonr.c

#lua
SRCS+= lapi.c \
lauxlib.c \
Expand Down Expand Up @@ -219,6 +223,7 @@ SRCS+= abd.c \
dsl_scan.c \
dsl_synctask.c \
dsl_userhold.c \
edonr_zfs.c \
fm.c \
gzip.c \
lzjb.c \
Expand Down Expand Up @@ -345,6 +350,7 @@ CFLAGS.dmu_traverse.c= -Wno-cast-qual
CFLAGS.dsl_dir.c= -Wno-cast-qual
CFLAGS.dsl_deadlist.c= -Wno-cast-qual
CFLAGS.dsl_prop.c= -Wno-cast-qual
CFLAGS.edonr.c=-Wno-cast-qual
CFLAGS.fm.c= -Wno-cast-qual
CFLAGS.lz4.c= -Wno-cast-qual
CFLAGS.spa.c= -Wno-cast-qual
Expand Down
8 changes: 2 additions & 6 deletions module/zcommon/zfeature_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,8 @@ zfs_mod_supported_feature(const char *name)
* tree, but this has not been done yet. Therefore, we return
* that all features except edonr are supported.
*/
#if defined(__FreeBSD__)
if (strcmp(name, "org.illumos:edonr") == 0)
return (B_FALSE);
else
return (B_TRUE);
#elif defined(_KERNEL) || defined(LIB_ZPOOL_BUILD)

#if defined(_KERNEL) || defined(LIB_ZPOOL_BUILD) || defined(__FreeBSD__)
return (B_TRUE);
#else
return (zfs_mod_supported(ZFS_SYSFS_POOL_FEATURES, name));
Expand Down
14 changes: 0 additions & 14 deletions module/zcommon/zfs_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ zfs_prop_init(void)
{ "noparity", ZIO_CHECKSUM_NOPARITY },
{ "sha512", ZIO_CHECKSUM_SHA512 },
{ "skein", ZIO_CHECKSUM_SKEIN },
#if !defined(__FreeBSD__)

{ "edonr", ZIO_CHECKSUM_EDONR },
#endif
{ NULL }
};

Expand All @@ -103,11 +100,8 @@ zfs_prop_init(void)
{ "skein", ZIO_CHECKSUM_SKEIN },
{ "skein,verify",
ZIO_CHECKSUM_SKEIN | ZIO_CHECKSUM_VERIFY },
#if !defined(__FreeBSD__)

{ "edonr,verify",
ZIO_CHECKSUM_EDONR | ZIO_CHECKSUM_VERIFY },
#endif
{ NULL }
};

Expand Down Expand Up @@ -396,21 +390,13 @@ zfs_prop_init(void)
zprop_register_index(ZFS_PROP_CHECKSUM, "checksum",
ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM |
ZFS_TYPE_VOLUME,
#if !defined(__FreeBSD__)
"on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein"
" | edonr",
#else
"on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein",
#endif
"CHECKSUM", checksum_table);
zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF,
PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
"on | off | verify | sha256[,verify] | sha512[,verify] | "
#if !defined(__FreeBSD__)
"skein[,verify] | edonr,verify",
#else
"skein[,verify]",
#endif
"DEDUP", dedup_table);
zprop_register_index(ZFS_PROP_COMPRESSION, "compression",
ZIO_COMPRESS_DEFAULT, PROP_INHERIT,
Expand Down
4 changes: 0 additions & 4 deletions module/zfs/zio_checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,10 @@ zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
abd_checksum_skein_tmpl_init, abd_checksum_skein_tmpl_free,
ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_DEDUP |
ZCHECKSUM_FLAG_SALTED | ZCHECKSUM_FLAG_NOPWRITE, "skein"},
#if !defined(__FreeBSD__)
{{abd_checksum_edonr_native, abd_checksum_edonr_byteswap},
abd_checksum_edonr_tmpl_init, abd_checksum_edonr_tmpl_free,
ZCHECKSUM_FLAG_METADATA | ZCHECKSUM_FLAG_SALTED |
ZCHECKSUM_FLAG_NOPWRITE, "edonr"},
#endif
};

/*
Expand All @@ -213,10 +211,8 @@ zio_checksum_to_feature(enum zio_checksum cksum)
return (SPA_FEATURE_SHA512);
case ZIO_CHECKSUM_SKEIN:
return (SPA_FEATURE_SKEIN);
#if !defined(__FreeBSD__)
case ZIO_CHECKSUM_EDONR:
return (SPA_FEATURE_EDONR);
#endif
default:
return (SPA_FEATURE_NONE);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/runfiles/common.run
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit',
tags = ['functional', 'channel_program', 'synctask_core']

[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']
tags = ['functional', 'checksum']

Expand Down
4 changes: 0 additions & 4 deletions tests/runfiles/linux.run
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ tags = ['functional', 'atime']
tests = ['chattr_001_pos', 'chattr_002_neg']
tags = ['functional', 'chattr']

[tests/functional/checksum:Linux]
tests = ['run_edonr_test']
tags = ['functional', 'checksum']

[tests/functional/cli_root/zfs:Linux]
tests = ['zfs_003_neg']
tags = ['functional', 'cli_root', 'zfs']
Expand Down
4 changes: 1 addition & 3 deletions tests/zfs-tests/tests/functional/checksum/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ dist_pkgdata_DATA = \
pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum

pkgexec_PROGRAMS = \
edonr_test \
skein_test \
sha2_test

skein_test_SOURCES = skein_test.c
sha2_test_SOURCES = sha2_test.c

if BUILD_LINUX
pkgexec_PROGRAMS += edonr_test
edonr_test_SOURCES = edonr_test.c
endif
5 changes: 1 addition & 4 deletions tests/zfs-tests/tests/functional/checksum/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,4 @@

. $STF_SUITE/include/libtest.shlib

set -A CHECKSUM_TYPES "fletcher2" "fletcher4" "sha256" "sha512" "skein"
if ! is_freebsd; then
CHECKSUM_TYPES+=("edonr")
fi
set -A CHECKSUM_TYPES "fletcher2" "fletcher4" "sha256" "sha512" "skein" "edonr"
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@
verify_runnable "both"

set -A dataset "$TESTPOOL" "$TESTPOOL/$TESTFS" "$TESTPOOL/$TESTVOL"
set -A values "on" "off" "fletcher2" "fletcher4" "sha256" "sha512" "skein" "noparity"
if is_linux; then
values+=("edonr")
fi
set -A values "on" "off" "fletcher2" "fletcher4" "sha256" "sha512" "skein" "edonr" "noparity"

log_assert "Setting a valid checksum on a file system, volume," \
"it should be successful."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ typeset -a properties=(
"feature@large_blocks"
"feature@sha512"
"feature@skein"
"feature@edonr"
"feature@device_removal"
"feature@obsolete_counts"
"feature@zpool_checkpoint"
Expand All @@ -97,10 +98,4 @@ if is_linux || is_freebsd; then
"feature@livelist"
"feature@zstd_compress"
)
fi

if ! is_freebsd; then
properties+=(
"feature@edonr"
)
fi
fi

0 comments on commit 269b5da

Please sign in to comment.