aboutsummaryrefslogtreecommitdiff
path: root/util/async.c
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2022-12-07 14:18:24 +0100
committerKevin Wolf <kwolf@redhat.com>2022-12-15 16:07:43 +0100
commit587d82fae258794e33cacc9bf4ba61949184e822 (patch)
tree3d80bda075264f5766c79e81cab5d3358ac87055 /util/async.c
parent8aa77000c2ba8c234f72b9b4162529d02ea00188 (diff)
downloadqemu-587d82fae258794e33cacc9bf4ba61949184e822.zip
qemu-587d82fae258794e33cacc9bf4ba61949184e822.tar.gz
qemu-587d82fae258794e33cacc9bf4ba61949184e822.tar.bz2
async: Register/unregister aiocontext in graph lock list
Add/remove the AioContext in aio_context_list in graph-lock.c when it is created/destroyed. This allows using the graph locking operations from this AioContext. In order to allow linking util/async.c with binaries that don't include the block layer, introduce stubs for (un)register_aiocontext(). Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20221207131838.239125-5-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util/async.c')
-rw-r--r--util/async.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/async.c b/util/async.c
index 63434dd..14d63b3 100644
--- a/util/async.c
+++ b/util/async.c
@@ -27,6 +27,7 @@
#include "qapi/error.h"
#include "block/aio.h"
#include "block/thread-pool.h"
+#include "block/graph-lock.h"
#include "qemu/main-loop.h"
#include "qemu/atomic.h"
#include "qemu/rcu_queue.h"
@@ -376,6 +377,7 @@ aio_ctx_finalize(GSource *source)
qemu_rec_mutex_destroy(&ctx->lock);
qemu_lockcnt_destroy(&ctx->list_lock);
timerlistgroup_deinit(&ctx->tlg);
+ unregister_aiocontext(ctx);
aio_context_destroy(ctx);
}
@@ -574,6 +576,8 @@ AioContext *aio_context_new(Error **errp)
ctx->thread_pool_min = 0;
ctx->thread_pool_max = THREAD_POOL_MAX_THREADS_DEFAULT;
+ register_aiocontext(ctx);
+
return ctx;
fail:
g_source_destroy(&ctx->source);