Author: mjg
Date: Mon Nov  2 17:39:59 2020
New Revision: 367276
URL: https://svnweb.freebsd.org/changeset/base/367276

Log:
  zfs: zstd: short-circuit cleaning buffers if none exist
  
  This avoids a barrage of locking every minute.

Modified:
  head/sys/contrib/openzfs/module/zstd/zfs_zstd.c

Modified: head/sys/contrib/openzfs/module/zstd/zfs_zstd.c
==============================================================================
--- head/sys/contrib/openzfs/module/zstd/zfs_zstd.c     Mon Nov  2 17:39:15 
2020        (r367275)
+++ head/sys/contrib/openzfs/module/zstd/zfs_zstd.c     Mon Nov  2 17:39:59 
2020        (r367276)
@@ -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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to