aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTino Reichardt <[email protected]>2022-06-21 23:32:09 +0200
committerGitHub <[email protected]>2022-06-21 14:32:09 -0700
commitdeb1213098e2dc10e6eee5e5c57bb40584e096a6 (patch)
treee2405b47aef3e81fbfaab04423a8111dcb4e2631 /include
parentb17663f571bfa1ef5e77d3c72f1610bacfc0c6ad (diff)
Fix memory allocation issue for BLAKE3 context
The kmem_alloc(sizeof (*ctx), KM_NOSLEEP) call on FreeBSD can't be used in this code segment. Work around this by pre-allocating a percpu context array for later use. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tino Reichardt <[email protected]> Closes #13568
Diffstat (limited to 'include')
-rw-r--r--include/sys/blake3.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/sys/blake3.h b/include/sys/blake3.h
index e6650372c..b3391c5f2 100644
--- a/include/sys/blake3.h
+++ b/include/sys/blake3.h
@@ -92,6 +92,11 @@ void Blake3_Final(const BLAKE3_CTX *ctx, uint8_t *out);
void Blake3_FinalSeek(const BLAKE3_CTX *ctx, uint64_t seek, uint8_t *out,
size_t out_len);
+/* these are pre-allocated contexts */
+extern void **blake3_per_cpu_ctx;
+extern void blake3_per_cpu_ctx_init(void);
+extern void blake3_per_cpu_ctx_fini(void);
+
/* return number of supported implementations */
extern int blake3_get_impl_count(void);