[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 32/37] qcow2: make qcow2_co_create2() a coroutine_fn
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 32/37] qcow2: make qcow2_co_create2() a coroutine_fn |
Date: |
Fri, 2 Mar 2018 19:54:43 +0100 |
From: Stefan Hajnoczi <address@hidden>
qcow2_create2() calls qemu_co_mutex_lock(). Only a coroutine_fn may
call another coroutine_fn. In fact, qcow2_create2 is always called from
coroutine context.
Rename the function to add the "co" moniker and add coroutine_fn.
Reported-by: Marc-André Lureau <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 93fb625dcb..7cf3c1518a 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2725,11 +2725,12 @@ static uint64_t
qcow2_opt_get_refcount_bits_del(QemuOpts *opts, int version,
return refcount_bits;
}
-static int qcow2_create2(const char *filename, int64_t total_size,
- const char *backing_file, const char *backing_format,
- int flags, size_t cluster_size, PreallocMode prealloc,
- QemuOpts *opts, int version, int refcount_order,
- const char *encryptfmt, Error **errp)
+static int coroutine_fn
+qcow2_co_create2(const char *filename, int64_t total_size,
+ const char *backing_file, const char *backing_format,
+ int flags, size_t cluster_size, PreallocMode prealloc,
+ QemuOpts *opts, int version, int refcount_order,
+ const char *encryptfmt, Error **errp)
{
QDict *options;
@@ -2998,9 +2999,9 @@ static int coroutine_fn qcow2_co_create_opts(const char
*filename, QemuOpts *opt
refcount_order = ctz32(refcount_bits);
- ret = qcow2_create2(filename, size, backing_file, backing_fmt, flags,
- cluster_size, prealloc, opts, version, refcount_order,
- encryptfmt, &local_err);
+ ret = qcow2_co_create2(filename, size, backing_file, backing_fmt, flags,
+ cluster_size, prealloc, opts, version,
refcount_order,
+ encryptfmt, &local_err);
error_propagate(errp, local_err);
finish:
--
2.13.6
- [Qemu-block] [PULL 22/37] block: fix write with zero flag set and iovector provided, (continued)
- [Qemu-block] [PULL 22/37] block: fix write with zero flag set and iovector provided, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 23/37] iotest 033: add misaligned write-zeroes test via truncate, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 26/37] aio: rename aio_context_in_iothread() to in_aio_context_home_thread(), Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 24/37] specs/qcow2: Fix documentation of the compressed cluster descriptor, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 25/37] docs: document how to use the l2-cache-entry-size parameter, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 27/37] block: extract AIO_WAIT_WHILE() from BlockDriverState, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 28/37] block: add BlockBackend->in_flight counter, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 30/37] Revert "IDE: Do not flush empty CDROM drives", Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 29/37] block: test blk_aio_flush() with blk->root == NULL, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 32/37] qcow2: make qcow2_co_create2() a coroutine_fn,
Kevin Wolf <=
- [Qemu-block] [PULL 31/37] block: rename .bdrv_create() to .bdrv_co_create_opts(), Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 33/37] qemu-img: Make resize error message more general, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 34/37] block/ssh: Pull ssh_grow_file() from ssh_create(), Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 35/37] block/ssh: Make ssh_grow_file() blocking, Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 36/37] block/ssh: Add basic .bdrv_truncate(), Kevin Wolf, 2018/03/02
- [Qemu-block] [PULL 37/37] qcow2: Replace align_offset() with ROUND_UP(), Kevin Wolf, 2018/03/02
- Re: [Qemu-block] [Qemu-devel] [PULL 00/37] Block layer patches, Peter Maydell, 2018/03/05