svn commit: r363014 - in head: sys/geom/eli tests/sys/geom/class/eli
Alan Somers
asomers at FreeBSD.org
Wed Jul 8 17:12:13 UTC 2020
Author: asomers
Date: Wed Jul 8 17:12:12 2020
New Revision: 363014
URL: https://svnweb.freebsd.org/changeset/base/363014
Log:
geli: enable direct dispatch
geli does all of its crypto operations in a separate thread pool, so
g_eli_start, g_eli_read_done, and g_eli_write_done don't actually do very
much work. Enabling direct dispatch eliminates the g_up/g_down bottlenecks,
doubling IOPs on my system. This change does not affect the thread pool.
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D25587
Added:
head/tests/sys/geom/class/eli/reentrancy_test.sh (contents, props changed)
Modified:
head/sys/geom/eli/g_eli.c
head/tests/sys/geom/class/eli/Makefile
Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c Wed Jul 8 16:50:47 2020 (r363013)
+++ head/sys/geom/eli/g_eli.c Wed Jul 8 17:12:12 2020 (r363014)
@@ -734,6 +734,7 @@ g_eli_read_metadata_offset(struct g_class *mp, struct
gp->orphan = g_eli_orphan_spoil_assert;
gp->spoiled = g_eli_orphan_spoil_assert;
cp = g_new_consumer(gp);
+ cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
error = g_attach(cp, pp);
if (error != 0)
goto end;
@@ -882,6 +883,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp,
pp = NULL;
cp = g_new_consumer(gp);
+ cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
error = g_attach(cp, bpp);
if (error != 0) {
if (req != NULL) {
@@ -969,6 +971,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp,
* Create decrypted provider.
*/
pp = g_new_providerf(gp, "%s%s", bpp->name, G_ELI_SUFFIX);
+ pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
pp->mediasize = sc->sc_mediasize;
pp->sectorsize = sc->sc_sectorsize;
LIST_FOREACH(gap, &bpp->aliases, ga_next)
Modified: head/tests/sys/geom/class/eli/Makefile
==============================================================================
--- head/tests/sys/geom/class/eli/Makefile Wed Jul 8 16:50:47 2020 (r363013)
+++ head/tests/sys/geom/class/eli/Makefile Wed Jul 8 17:12:12 2020 (r363014)
@@ -17,6 +17,7 @@ ATF_TESTS_SH+= kill_test
ATF_TESTS_SH+= misc_test
ATF_TESTS_SH+= onetime_test
ATF_TESTS_SH+= online_resize_test
+ATF_TESTS_SH+= reentrancy_test
ATF_TESTS_SH+= resize_test
ATF_TESTS_SH+= setkey_test
Added: head/tests/sys/geom/class/eli/reentrancy_test.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/tests/sys/geom/class/eli/reentrancy_test.sh Wed Jul 8 17:12:12 2020 (r363014)
@@ -0,0 +1,69 @@
+# $FreeBSD$
+
+# Test various operations for geli-on-geli providers, to ensure that geli is
+# reentrant.
+
+. $(atf_get_srcdir)/conf.sh
+
+init_test()
+{
+ cipher=$1
+ aalgo=$2
+ secsize=$3
+ ealgo=${cipher%%:*}
+ keylen=${cipher##*:}
+
+ atf_check dd if=/dev/random of=testdata bs=$secsize count=1 status=none
+ atf_check dd if=/dev/random of=keyfile bs=$secsize count=16 status=none
+
+ # Create the lower geli device
+ atf_check -s exit:0 -e ignore \
+ geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \
+ -s $secsize ${md}
+ atf_check geli attach -p -k keyfile ${md}
+ # Create the upper geli device
+ atf_check -s exit:0 -e ignore \
+ geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \
+ -s $secsize ${md}.eli
+ atf_check geli attach -p -k keyfile ${md}.eli
+ echo ${md} > layered_md_device
+
+ # Ensure we can read and write.
+ atf_check dd if=testdata of=/dev/${md}.eli.eli bs=$secsize count=1 \
+ status=none
+ atf_check dd if=/dev/${md}.eli.eli of=cmpdata bs=$secsize count=1 \
+ status=none
+ atf_check cmp -s testdata cmpdata
+
+ geli detach ${md}.eli 2>/dev/null
+}
+
+atf_test_case init cleanup
+init_head()
+{
+ atf_set "descr" "Initialize a geli provider on top of another"
+ atf_set "require.user" "root"
+ atf_set "timeout" 600
+}
+init_body()
+{
+ sectors=2
+ geli_test_setup
+
+ for_each_geli_config init_test
+}
+init_cleanup()
+{
+ if [ -f layered_md_device ]; then
+ while read provider; do
+ [ -c /dev/${md}.eli.eli ] && \
+ geli detach $md.eli.eli 2>/dev/null
+ done < layered_md_device
+ fi
+ geli_test_cleanup
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case init
+}
More information about the svn-src-head
mailing list