- Update zstdpool.diff in order to fix boo#1197643.

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=603
This commit is contained in:
Michael Schröder 2022-04-13 13:52:00 +00:00 committed by Git OBS Bridge
parent f65ecb87e0
commit 79f9d56fb8
3 changed files with 16 additions and 6 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Mar 30 08:54:50 UTC 2022 - Martin Liška <mliska@suse.cz>
- Update zstdpool.diff in order to fix boo#1197643.
-------------------------------------------------------------------
Mon Mar 14 10:50:39 UTC 2022 - Dirk Müller <dmueller@suse.com>

View File

@ -183,8 +183,8 @@ Requires: findutils
Requires: gawk
Requires: gcc
#Requires: gcc-PIE
Requires: gettext-tools
Requires: /usr/bin/gzip
Requires: gettext-tools
Requires: glibc-devel
Requires: glibc-locale-base
Requires: grep

View File

@ -1,5 +1,5 @@
--- ./rpmio/rpmio.c.orig 2021-10-14 12:34:22.865316722 +0000
+++ ./rpmio/rpmio.c 2021-10-14 13:37:56.835119919 +0000
--- ./rpmio/rpmio.c.orig 2021-06-21 12:00:44.648612706 +0000
+++ ./rpmio/rpmio.c 2022-04-13 13:48:55.224954032 +0000
@@ -8,6 +8,7 @@
#include <ctype.h>
#include <dirent.h>
@ -16,7 +16,7 @@
#include <zstd.h>
typedef struct rpmzstd_s {
@@ -1048,6 +1050,27 @@ typedef struct rpmzstd_s {
@@ -1048,6 +1050,29 @@ typedef struct rpmzstd_s {
ZSTD_outBuffer zob; /*!< ZSTD_outBuffer */
} * rpmzstd;
@ -24,6 +24,7 @@
+
+static pthread_once_t zstdThreadPoolCreated = PTHREAD_ONCE_INIT;
+static ZSTD_threadPool *zstdThreadPool;
+static int zstdThreadPoolThreads;
+
+static void zstdCreateThreadPool(void)
+{
@ -31,6 +32,7 @@
+ if (numthreads >= 0)
+ numthreads = get_compression_threads(numthreads > 0 ? numthreads : -1);
+ if (numthreads > 0) {
+ zstdThreadPoolThreads = numthreads;
+ zstdThreadPool = ZSTD_createThreadPool(numthreads);
+ if (!zstdThreadPool)
+ rpmlog(RPMLOG_WARNING, "Could not create zstd thread pool for %d threads\n", numthreads);
@ -44,7 +46,7 @@
static rpmzstd rpmzstdNew(int fdno, const char *fmode)
{
int flags = 0;
@@ -1133,8 +1156,15 @@ static rpmzstd rpmzstdNew(int fdno, cons
@@ -1133,8 +1158,18 @@ static rpmzstd rpmzstdNew(int fdno, cons
threads = get_compression_threads(threads);
if (threads > 0) {
@ -54,8 +56,11 @@
+ } else {
+#if ZSTD_VERSION_NUMBER >= 10407
+ pthread_once(&zstdThreadPoolCreated, zstdCreateThreadPool);
+ if (zstdThreadPool)
+ if (zstdThreadPool) {
+ if (threads > zstdThreadPoolThreads)
+ ZSTD_CCtx_setParameter(_stream, ZSTD_c_nbWorkers, zstdThreadPoolThreads);
+ ZSTD_CCtx_refThreadPool(_stream, zstdThreadPool);
+ }
+#endif
+ }
}