This serie of patches aims to reduce the usage of the global AioContexlock in block-copy, by introducing smaller granularity locks thus on making the block layer thread safe.
This serie depends on Paolo's coroutine_sleep API and my previous serie that brings thread safety to the smaller API used by block-copy, like ratelimit, progressmeter abd co-shared-resource. What's missing for block-copy to be fully thread-safe is fixing the CoSleep API to allow cross-thread sleep and wakeup. Paolo is working on it and will post the patches once his new CoSleep API is accepted. Patch 1 introduces the .method field instead of .use_copy_range and .copy_size, so that it can be later used as atomic. Patch 2-3 provide comments and refactoring in preparation to the locks added in patch 4 on BlockCopyTask, patch 5-6 on BlockCopyCallState and 7 BlockCopyState. Based-on: <20210517100548.28806-1-pbonz...@redhat.com> Based-on: <20210518094058.25952-1-eespo...@redhat.com> Signed-off-by: Emanuele Giuseppe Esposito <eespo...@redhat.com> --- v1 -> v2: * More field categorized as IN/State/OUT in the various struct, better documentation in the structs * Fix a couple of places where I missed locks [Vladimir, Paolo] Emanuele Giuseppe Esposito (6): block-copy: improve documentation of BlockCopyTask and BlockCopyState types and functions block-copy: move progress_set_remaining in block_copy_task_end block-copy: add a CoMutex to the BlockCopyTask list block-copy: add QemuMutex lock for BlockCopyCallState list block-copy: atomic .cancelled and .finished fields in BlockCopyCallState block-copy: protect BlockCopyState .method fields Paolo Bonzini (1): block-copy: streamline choice of copy_range vs. read/write block/block-copy.c | 234 +++++++++++++++++++++++++++++---------------- 1 file changed, 150 insertions(+), 84 deletions(-) -- 2.30.2