Wei Yang <richardw.y...@linux.intel.com> wrote: > On Wed, May 15, 2019 at 02:15:44PM +0200, Juan Quintela wrote: >>This is still a work in progress, but get everything sent as expected >>and it is faster than the code that is already there. > > Generally, I prefer to merge this one with previous one.
Done, sir O:-) For the WIP part, it was easier to have the bits that didn't change and the ones that I was working with. >>@@ -1145,7 +1239,11 @@ static void *multifd_send_thread(void *opaque) >> /* initial packet */ >> p->num_packets = 1; >> >>- multifd_send_state->ops = &multifd_none_ops; >>+ if (migrate_use_multifd_zlib()) { >>+ multifd_send_state->ops = &multifd_zlib_ops; >>+ } else { >>+ multifd_send_state->ops = &multifd_none_ops; >>+ } > > Again, to manipulate a global variable in each thread is not a good idea. Fixed. > This would be better to use an array to assign ops instead of *if*. In case > you would have several compress methods, the code would be difficult to read. it is going to end: if (migrate_use_multifd_zlib()) { multifd_send_state->ops = &multifd_zlib_ops; if (migrate_use_multifd_zstd()) { multifd_send_state->ops = &multifd_zstd_ops; } else { multifd_send_state->ops = &multifd_none_ops; } We can use: multifd_send_state->ops = multifd_ops[migrate_multifd_method(void)]; About what is easier to read ..... it depends on taste. Will change anyways. Thanks, Juan.