summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito2021-06-24 09:20:43 +0200
committerVladimir Sementsov-Ogievskiy2021-06-25 13:33:51 +0200
commit149009bef4b4b4db37b3cf72b41dc2c6e8ca1885 (patch)
treeb07a043b4259059d8eec8dd6bbf0ae733899b03e /include
parentblock-copy: add CoMutex lock (diff)
downloadqemu-149009bef4b4b4db37b3cf72b41dc2c6e8ca1885.tar.gz
qemu-149009bef4b4b4db37b3cf72b41dc2c6e8ca1885.tar.xz
qemu-149009bef4b4b4db37b3cf72b41dc2c6e8ca1885.zip
block-copy: atomic .cancelled and .finished fields in BlockCopyCallState
By adding acquire/release pairs, we ensure that .ret and .error_is_read fields are written by block_copy_dirty_clusters before .finished is true, and that they are read by API user after .finished is true. The atomic here are necessary because the fields are concurrently modified in coroutines, and read outside. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20210624072043.180494-6-eesposit@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block-copy.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/block/block-copy.h b/include/block/block-copy.h
index 338f2ea7fd..5c8278895c 100644
--- a/include/block/block-copy.h
+++ b/include/block/block-copy.h
@@ -18,6 +18,8 @@
#include "block/block.h"
#include "qemu/co-shared-resource.h"
+/* All APIs are thread-safe */
+
typedef void (*BlockCopyAsyncCallbackFunc)(void *opaque);
typedef struct BlockCopyState BlockCopyState;
typedef struct BlockCopyCallState BlockCopyCallState;