qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Eric Blake <eblake@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, fam@euphon.net, ehabkost@redhat.com,
	qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com,
	crosa@redhat.com, den@openvz.org
Subject: Re: [PATCH v3 1/3] block/io: refactor coroutine wrappers
Date: Sat, 23 May 2020 01:48:21 +0300	[thread overview]
Message-ID: <c241405c-1c9b-17e7-0028-c9ac3cae815d@virtuozzo.com> (raw)
In-Reply-To: <d3e7dbc9-ba3b-965d-726b-8a99007a8e08@redhat.com>

23.05.2020 00:33, Eric Blake wrote:
> On 5/22/20 11:19 AM, Vladimir Sementsov-Ogievskiy wrote:
>> Most of coroutine wrappers already follow this notation:
> 
> s/of/of our/
> s/notation/convention/
> 
>>
>> We have coroutine_fn bdrv_co_<something>(<normal argument list>), which
>> is the core functions, and wrapper, which does polling loope is called
>> bdrv_<something>(<same argument list>).
> 
> We have 'coroutine_fn bdrv_co_<something>(<normal argument list>)' as the core function, and a wrapper 'bdrv_<something>(<same argument list>)' which does a polling loop.
> 
>>
>> The only outsiders are bdrv_prwv_co and bdrv_common_block_status_above
> 
> s/are/are the/
> 
>> wrappers. Let's refactor the to behave as the others, it simplifies
> 
> s/the/them/
> 
>> further conversion of coroutine wrappers.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>   block/io.c | 61 +++++++++++++++++++++++++++++-------------------------
>>   1 file changed, 33 insertions(+), 28 deletions(-)
>>
>> diff --git a/block/io.c b/block/io.c
>> index 121ce17a49..bd00a70b47 100644
>> --- a/block/io.c
>> +++ b/block/io.c
>> @@ -900,28 +900,32 @@ typedef struct RwCo {
>>       BdrvRequestFlags flags;
>>   } RwCo;
>> +static int coroutine_fn bdrv_co_prwv(BdrvChild *child, int64_t offset,
>> +                                     QEMUIOVector *qiov, bool is_write,
>> +                                     BdrvRequestFlags flags)
>> +{
>> +    if (is_write) {
>> +        return bdrv_co_pwritev(child, offset, qiov->size, qiov, flags);
>> +    } else {
>> +        return bdrv_co_preadv(child, offset, qiov->size, qiov, flags);
>> +    }
>> +}
>> +
> 
> If we're trying to avoid needless indirection, wouldn't it be simpler to quit trying to slam reads and writes through a single prwv function that then has to split back out, and instead make two separate coroutine wrappers, one for just reads, and the other for just writes, without having to mess with a 'bool is_write' parameter?

Yes, and it's simpler after the transformation than before. I even wanted to do it but forget.. Will do as a follow-up, or with next version.

> 
>>   static void coroutine_fn bdrv_rw_co_entry(void *opaque)
>>   {
> 
> That is, should we have bdrv_co_preadv_entry and bdrv_co_pwritev_entry instead of just one bdrv_rw_co_entry?
> 
> At any rate, the renames done here are mechanical enough that if we make further changes, it could be a separate commit.
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 


-- 
Best regards,
Vladimir


  reply	other threads:[~2020-05-22 22:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 16:19 [PATCH v3 0/3] coroutines: generate wrapper code Vladimir Sementsov-Ogievskiy
2020-05-22 16:19 ` [PATCH v3 1/3] block/io: refactor coroutine wrappers Vladimir Sementsov-Ogievskiy
2020-05-22 21:33   ` Eric Blake
2020-05-22 22:48     ` Vladimir Sementsov-Ogievskiy [this message]
2020-05-22 16:19 ` [PATCH v3 2/3] block: declare some coroutine functions in block/coroutines.h Vladimir Sementsov-Ogievskiy
2020-05-22 21:35   ` Eric Blake
2020-05-22 16:19 ` [PATCH v3 3/3] block: generate coroutine-wrapper code Vladimir Sementsov-Ogievskiy
2020-05-22 21:18 ` [PATCH v3 0/3] coroutines: generate wrapper code no-reply
2020-05-22 21:23 ` no-reply
2020-05-22 21:29 ` no-reply

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=c241405c-1c9b-17e7-0028-c9ac3cae815d@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=crosa@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=fam@euphon.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@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).