From 79f9d56fb8e1dfcf223b208b9de8ecca3e1461631510e0e0be54dbf5e683c776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Wed, 13 Apr 2022 13:52:00 +0000 Subject: [PATCH] - Update zstdpool.diff in order to fix boo#1197643. OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=603 --- rpm.changes | 5 +++++ rpm.spec | 2 +- zstdpool.diff | 15 ++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/rpm.changes b/rpm.changes index effd00d..998ecd7 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Mar 30 08:54:50 UTC 2022 - Martin Liška + +- Update zstdpool.diff in order to fix boo#1197643. + ------------------------------------------------------------------- Mon Mar 14 10:50:39 UTC 2022 - Dirk Müller diff --git a/rpm.spec b/rpm.spec index 484a95a..a6a0d2e 100644 --- a/rpm.spec +++ b/rpm.spec @@ -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 diff --git a/zstdpool.diff b/zstdpool.diff index a66e7ac..3127acb 100644 --- a/zstdpool.diff +++ b/zstdpool.diff @@ -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 #include @@ -16,7 +16,7 @@ #include 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 + } }