diff --git a/disable-asyncio-during-compression.patch b/disable-asyncio-during-compression.patch new file mode 100644 index 0000000000000000000000000000000000000000..c962aa55b470e8b49e060e07660aada04d969db7 --- /dev/null +++ b/disable-asyncio-during-compression.patch @@ -0,0 +1,53 @@ +From 44cd3c8451dbd64d40725655bebcb9b7d245e87d Mon Sep 17 00:00:00 2001 +From: Yann Collet +Date: Sat, 25 Oct 2025 00:50:55 -0700 +Subject: [PATCH] disable asyncio during compression + +it's not helpful for performance, and can in some times be detrimental. +the synchronous mode is also much easier to follow and debug. +--- + programs/fileio.c | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/programs/fileio.c b/programs/fileio.c +index 77f3d35f9bb..fec0e2d6620 100644 +--- a/programs/fileio.c ++++ b/programs/fileio.c +@@ -1147,8 +1147,14 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs, + dictBufferType = (useMMap && !forceNoUseMMap) ? FIO_mmapDict : FIO_mallocDict; + FIO_initDict(&ress.dict, dictFileName, prefs, &ress.dictFileStat, dictBufferType); /* works with dictFileName==NULL */ + +- ress.writeCtx = AIO_WritePool_create(prefs, ZSTD_CStreamOutSize()); +- ress.readCtx = AIO_ReadPool_create(prefs, ZSTD_CStreamInSize()); ++ { ++ /* Compression paths stay synchronous for now: lower overhead and easier upkeep. */ ++ int const savedAsyncIO = prefs->asyncIO; ++ prefs->asyncIO = 0; ++ ress.writeCtx = AIO_WritePool_create(prefs, ZSTD_CStreamOutSize()); ++ ress.readCtx = AIO_ReadPool_create(prefs, ZSTD_CStreamInSize()); ++ prefs->asyncIO = savedAsyncIO; ++ } + + /* Advanced parameters, including dictionary */ + if (dictFileName && (ress.dict.dictBuffer==NULL)) +@@ -2070,16 +2076,12 @@ FIO_compressFilename_srcFile(FIO_ctx_t* const fCtx, + srcFile = FIO_openSrcFile(prefs, srcFileName, &srcFileStat); + if (srcFile == NULL) return 1; /* srcFile could not be opened */ + +- /* Don't use AsyncIO for small files */ ++ /* AsyncIO is disabled for compression to favor predictable performance and simpler upkeep. */ + if (strcmp(srcFileName, stdinmark)) /* Stdin doesn't have stats */ + fileSize = UTIL_getFileSizeStat(&srcFileStat); +- if(fileSize != UTIL_FILESIZE_UNKNOWN && fileSize < ZSTD_BLOCKSIZE_MAX * 3) { +- AIO_ReadPool_setAsync(ress.readCtx, 0); +- AIO_WritePool_setAsync(ress.writeCtx, 0); +- } else { +- AIO_ReadPool_setAsync(ress.readCtx, 1); +- AIO_WritePool_setAsync(ress.writeCtx, 1); +- } ++ (void)fileSize; ++ AIO_ReadPool_setAsync(ress.readCtx, 0); ++ AIO_WritePool_setAsync(ress.writeCtx, 0); + + AIO_ReadPool_setFile(ress.readCtx, srcFile); + result = FIO_compressFilename_dstFile( diff --git a/zstd.spec b/zstd.spec index ac4fcd6ac25ba8dfe7114ac1f434cb04efc574b3..3c2ce2c3ab9d4c907ea8c2d8ca221da49cf1c6be 100644 --- a/zstd.spec +++ b/zstd.spec @@ -2,7 +2,7 @@ Name: zstd Version: 1.5.7 -Release: 6 +Release: 7 Summary: A fast lossless compression algorithm License: BSD-3-Clause AND GPL-2.0-only URL: https://github.com/facebook/zstd @@ -11,6 +11,7 @@ Source0: https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{ Patch9000: update-rm-command-description.patch Patch9001: fix-mingw-warnings-calloc-argument-order.patch Patch9002: Fix-undefined-names-in-automated_benchmarking.patch +Patch9003: disable-asyncio-during-compression.patch BuildRequires: gcc gcc-c++ BuildRequires: cmake >= 3.10 @@ -98,6 +99,9 @@ install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1 %doc %{_datadir}/doc/zstd/zstd_manual.html %changelog +* Fri Nov 14 2025 huangwenhua - 1.5.7-7 +- DESC: backport: disable asyncio during compression + * Mon Nov 10 2025 liuzhilin - 1.5.7-6 - Fix undefined names in automated_benchmarking.py - fix mingw warnings calloc argument order