From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] qcow2: Always execute preallocate() in a coroutine
Date: Wed, 11 Oct 2017 13:31:11 +0200 [thread overview]
Message-ID: <6fe61402-ff70-72cd-07e5-57638a6ffb89@redhat.com> (raw)
In-Reply-To: <474ed8c0-6ffc-b565-45c0-c9890826897c@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1592 bytes --]
On 2017-10-10 00:28, Eric Blake wrote:
> On 10/09/2017 04:55 PM, Max Reitz wrote:
>> Some qcow2 functions (at least perform_cow()) expect s->lock to be
>> taken. Therefore, if we want to make use of them, we should execute
>> preallocate() (as "preallocate_co") in a coroutine so that we can use
>> the qemu_co_mutex_* functions.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>> block/qcow2.c | 41 ++++++++++++++++++++++++++++++++++-------
>> 1 file changed, 34 insertions(+), 7 deletions(-)
>>
>
>> +++ b/block/qcow2.c
>> @@ -2460,6 +2460,14 @@ static int qcow2_set_up_encryption(BlockDriverState *bs, const char *encryptfmt,
>> }
>>
>>
>> +typedef struct PreallocCo {
>> + BlockDriverState *bs;
>> + uint64_t offset;
>> + uint64_t new_length;
>> +
>> + int ret;
>> +} PreallocCo;
>
> Because you create a typedef here...
>
>
>> +static void coroutine_fn preallocate_co(void *opaque)
>> {
>> + struct PreallocCo *params = opaque;
>
> you could drop 'struct' here, the way you already dropped it...
Ah, yes, that was from before I added the typedef... Will fix.
Max
>
>> +static int preallocate(BlockDriverState *bs,
>> + uint64_t offset, uint64_t new_length)
>> +{
>> + PreallocCo params = {
>> + .bs = bs,
>> + .offset = offset,
>> + .new_length = new_length,
>> + .ret = -EINPROGRESS,
>> + };
>
> ...here. But that doesn't change semantics, so either way,
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2017-10-11 11:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 21:55 [Qemu-devel] [PATCH 0/3] qcow2: Fix preallocated truncation Max Reitz
2017-10-09 21:55 ` [Qemu-devel] [PATCH 1/3] qcow2: Fix unaligned " Max Reitz
2017-10-09 21:57 ` Max Reitz
2017-10-09 22:25 ` Eric Blake
2017-10-11 11:30 ` Max Reitz
2017-10-09 23:30 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-10-09 21:55 ` [Qemu-devel] [PATCH 2/3] qcow2: Always execute preallocate() in a coroutine Max Reitz
2017-10-09 21:57 ` Max Reitz
2017-10-09 22:28 ` Eric Blake
2017-10-11 11:31 ` Max Reitz [this message]
2017-10-09 23:30 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-10-09 21:55 ` [Qemu-devel] [PATCH 3/3] iotests: Add cluster_size=64k to 125 Max Reitz
2017-10-09 22:32 ` Eric Blake
2017-10-09 23:30 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2017-10-11 13:23 ` [Qemu-devel] [PATCH 0/3] qcow2: Fix preallocated truncation Max Reitz
2017-10-11 15:05 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6fe61402-ff70-72cd-07e5-57638a6ffb89@redhat.com \
--to=mreitz@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).