]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
simplified "slows down when compression blocked"
authorYann Collet <cyan@fb.com>
Fri, 21 Sep 2018 23:35:43 +0000 (16:35 -0700)
committerYann Collet <cyan@fb.com>
Fri, 21 Sep 2018 23:35:43 +0000 (16:35 -0700)
programs/fileio.c

index 407680eff3fd8be234f6964115e5cff5f2775ea0..964870f39feb890ef13f1c857f09564840150e6d 100644 (file)
@@ -896,12 +896,12 @@ FIO_compressZstdFrame(const cRess_t* ressPtr,
                         assert(zfp.produced >= previous_zfp_update.produced);
                         assert(g_nbWorkers >= 1);
 
-                        /* test if output speed is so slow that all buffers are full
-                         * and no further progress is possible
-                         * (neither compression nor adding more input into internal buffers) */
-                        if ( (zfp.ingested == previous_zfp_update.ingested)   /* no data read : input buffer full */
-                          && (zfp.consumed == previous_zfp_update.consumed)   /* no data compressed : no more buffer to compress OR compression is really slow */
-                          && (zfp.nbActiveWorkers == 0)          /* confirmed : no compression : either no more buffer to compress OR not enough data to start first worker */
+                        /* test if compression is blocked
+                         * either because output is slow and all buffers are full
+                         * or because input is slow and no job can start while waiting for at least one buffer to be filled.
+                         * note : excluse starting part, since currentJobID > 1 */
+                        if ( (zfp.consumed == previous_zfp_update.consumed)   /* no data compressed : no data available, or no more buffer to compress to, OR compression is really slow (compression of a single block is slower than update rate)*/
+                          && (zfp.nbActiveWorkers == 0)                       /* confirmed : no compression ongoing */
                           ) {
                             DISPLAYLEVEL(6, "all buffers full : compression stopped => slow down \n")
                             speedChange = slower;