• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révisionfc6705229cbca807f2bab9a8acf22b0ab249e55c (tree)
l'heure2022-01-28 23:38:23
AuteurJuan Quintela <quintela@redh...>
CommiterJuan Quintela

Message de Log

multifd: Use proper maximum compression values

It happens that there are functions to calculate the worst possible
compression size for a packet. Use them.

Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Change Summary

Modification

--- a/migration/multifd-zlib.c
+++ b/migration/multifd-zlib.c
@@ -54,8 +54,8 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **errp)
5454 error_setg(errp, "multifd %u: deflate init failed", p->id);
5555 return -1;
5656 }
57- /* To be safe, we reserve twice the size of the packet */
58- z->zbuff_len = MULTIFD_PACKET_SIZE * 2;
57+ /* This is the maxium size of the compressed buffer */
58+ z->zbuff_len = compressBound(MULTIFD_PACKET_SIZE);
5959 z->zbuff = g_try_malloc(z->zbuff_len);
6060 if (!z->zbuff) {
6161 deflateEnd(&z->zs);
--- a/migration/multifd-zstd.c
+++ b/migration/multifd-zstd.c
@@ -67,8 +67,8 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **errp)
6767 p->id, ZSTD_getErrorName(res));
6868 return -1;
6969 }
70- /* To be safe, we reserve twice the size of the packet */
71- z->zbuff_len = MULTIFD_PACKET_SIZE * 2;
70+ /* This is the maxium size of the compressed buffer */
71+ z->zbuff_len = ZSTD_compressBound(MULTIFD_PACKET_SIZE);
7272 z->zbuff = g_try_malloc(z->zbuff_len);
7373 if (!z->zbuff) {
7474 ZSTD_freeCStream(z->zcs);