From 184f69772627366c79cea5fb8522571974caec49 Mon Sep 17 00:00:00 2001 From: Alain Spineux Date: Thu, 10 Aug 2023 15:41:01 +0200 Subject: [PATCH] Fix ZSTD compression level ignored in FileSet - before all ZSTD* where enabling ZSTD level 10 now all ZSTD* match there own level and ZSTD match ZSTD10 - embellish the code --- bacula/src/filed/backup.c | 5 +++-- bacula/src/filed/job.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index dac29f88c..dcea6fea3 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -227,8 +227,9 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr) #ifdef HAVE_ZSTD ZSTD_freeCCtx((ZSTD_CCtx*)jcr->ZSTD_compress_workset); + jcr->ZSTD_compress_workset = NULL; #endif - + crypto_session_end(jcr); bdelete_and_null(jcr->sd_packet_mgr); @@ -1543,7 +1544,7 @@ static bool do_zstd_compression(bctx_t &bctx) size_t ret = ZSTD_compressCCtx((ZSTD_CCtx*) jcr->ZSTD_compress_workset, bctx.cbuf2, bctx.max_compress_len, bctx.rbuf, sd->msglen, - 10); + bctx.ff_pkt->Compress_level); if (ZSTD_isError(ret)) { /** this should NEVER happen */ diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index d7f2d14c0..c0d9f3db3 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -2099,6 +2099,8 @@ static int set_options(findFOPTS *fo, const char *opts) fo->Compress_level = 10; break; } + } else { + Dmsg1(10, "Ignore unknown compression code Z%c in the FileSet\n", *p); } break; case 'd': /* Deduplication 0=none 1=Storage 2=Local */ -- 2.47.3