aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-11-02 17:39:59 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-11-02 17:39:59 +0000
commit36639c3942f587e652d2aba6a71ad45b64c2ce47 (patch)
tree285302123930366c65e4580f85d3ab787ddb9731
parente1b6a7f83f144a03685f53b235c197ee0c24ae3a (diff)
downloadsrc-36639c3942f587e652d2aba6a71ad45b64c2ce47.tar.gz
src-36639c3942f587e652d2aba6a71ad45b64c2ce47.zip
zfs: zstd: short-circuit cleaning buffers if none exist
This avoids a barrage of locking every minute.
Notes
Notes: svn path=/head/; revision=367276
-rw-r--r--sys/contrib/openzfs/module/zstd/zfs_zstd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/contrib/openzfs/module/zstd/zfs_zstd.c b/sys/contrib/openzfs/module/zstd/zfs_zstd.c
index 5c896478f970..3d1805f49cca 100644
--- a/sys/contrib/openzfs/module/zstd/zfs_zstd.c
+++ b/sys/contrib/openzfs/module/zstd/zfs_zstd.c
@@ -700,6 +700,13 @@ zstd_mempool_deinit(void)
void
zfs_zstd_cache_reap_now(void)
{
+
+ /*
+ * Short-circuit if there are no buffers to begin with.
+ */
+ if (ZSTDSTAT(zstd_stat_buffers) == 0)
+ return;
+
/*
* calling alloc with zero size seeks
* and releases old unused objects