int64_t size;
int ret;
Coroutine *coroutine;
- AioContext *aio_context;
} GlusterAIOCB;
typedef struct BDRVGlusterState {
acb->ret = -EIO; /* Partial read/write - fail it */
}
- aio_co_schedule(acb->aio_context, acb->coroutine);
+ /*
+ * Safe to call: The coroutine will yield exactly once awaiting this
+ * scheduling, and the context is its own context, so it will be scheduled
+ * once it does yield.
+ *
+ * (aio_co_wake() would call qemu_get_current_aio_context() to check whether
+ * we are in the same context, but we are not in a qemu thread, so we cannot
+ * do that. Use aio_co_schedule() directly.)
+ */
+ aio_co_schedule(qemu_coroutine_get_aio_context(acb->coroutine),
+ acb->coroutine);
}
static void qemu_gluster_parse_flags(int bdrv_flags, int *open_flags)
acb.size = bytes;
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
- acb.aio_context = bdrv_get_aio_context(bs);
ret = glfs_zerofill_async(s->fd, offset, bytes, gluster_finish_aiocb, &acb);
if (ret < 0) {
acb.size = size;
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
- acb.aio_context = bdrv_get_aio_context(bs);
if (write) {
ret = glfs_pwritev_async(s->fd, qiov->iov, qiov->niov, offset, 0,
acb.size = 0;
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
- acb.aio_context = bdrv_get_aio_context(bs);
ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
if (ret < 0) {
acb.size = 0;
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
- acb.aio_context = bdrv_get_aio_context(bs);
ret = glfs_discard_async(s->fd, offset, bytes, gluster_finish_aiocb, &acb);
if (ret < 0) {