aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/module/zstd
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2020-10-01 23:28:21 +0000
committerMatt Macy <mmacy@FreeBSD.org>2020-10-01 23:28:21 +0000
commitc40487d49bde43806672a0917a7ccc5d1e6301fd (patch)
tree57d0633d07fdee5d1cf318c53be9d183d61de835 /sys/contrib/openzfs/module/zstd
parent494955366a2053888d12f741ae883b48e552ca90 (diff)
parente2228bd99047bb6a0cef0da931147b1f28f155c2 (diff)
downloadsrc-c40487d49bde43806672a0917a7ccc5d1e6301fd.tar.gz
src-c40487d49bde43806672a0917a7ccc5d1e6301fd.zip
OpenZFS: MFV 2.0-rc3-gfc5966
- Annotate FreeBSD sysctls with CTLFLAG_MPSAFE - Reduce stack usage of Lua - Don't save user FPU context in kernel threads - Add support for procfs_list - Code cleanup in zio_crypt - Add DB_RF_NOPREFETCH to dbuf_read()s in dnode.c - Drop references when skipping dmu_send due to EXDEV - Eliminate gratuitous bzeroing in dbuf_stats_hash_table_data - Fix legacy compat for platform IOCs
Notes
Notes: svn path=/head/; revision=366350
Diffstat (limited to 'sys/contrib/openzfs/module/zstd')
-rw-r--r--sys/contrib/openzfs/module/zstd/zfs_zstd.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/contrib/openzfs/module/zstd/zfs_zstd.c b/sys/contrib/openzfs/module/zstd/zfs_zstd.c
index 431801d47c37..34c56b7a7fdf 100644
--- a/sys/contrib/openzfs/module/zstd/zfs_zstd.c
+++ b/sys/contrib/openzfs/module/zstd/zfs_zstd.c
@@ -238,7 +238,7 @@ zstd_mempool_alloc(struct zstd_pool *zstd_mempool, size_t size)
* Check if objects fits the size, if so we take it and
* update the timestamp.
*/
- if (!mem && pool->mem && size <= pool->size) {
+ if (size && !mem && pool->mem && size <= pool->size) {
pool->timeout = gethrestime_sec() +
ZSTD_POOL_TIMEOUT;
mem = pool->mem;
@@ -257,7 +257,7 @@ zstd_mempool_alloc(struct zstd_pool *zstd_mempool, size_t size)
}
}
- if (mem) {
+ if (!size || mem) {
return (mem);
}
@@ -688,6 +688,19 @@ zstd_mempool_deinit(void)
zstd_mempool_cctx = NULL;
}
+/* release unused memory from pool */
+
+void
+zfs_zstd_cache_reap_now(void)
+{
+ /*
+ * calling alloc with zero size seeks
+ * and releases old unused objects
+ */
+ zstd_mempool_alloc(zstd_mempool_cctx, 0);
+ zstd_mempool_alloc(zstd_mempool_dctx, 0);
+}
+
extern int __init
zstd_init(void)
{
@@ -729,10 +742,11 @@ module_init(zstd_init);
module_exit(zstd_fini);
ZFS_MODULE_DESCRIPTION("ZSTD Compression for ZFS");
-ZFS_MODULE_LICENSE("BSD");
+ZFS_MODULE_LICENSE("Dual BSD/GPL");
ZFS_MODULE_VERSION(ZSTD_VERSION_STRING);
EXPORT_SYMBOL(zfs_zstd_compress);
EXPORT_SYMBOL(zfs_zstd_decompress_level);
EXPORT_SYMBOL(zfs_zstd_decompress);
+EXPORT_SYMBOL(zfs_zstd_cache_reap_now);
#endif