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 v4 4/5] block: drop bdrv_prwv
Date: Wed, 27 May 2020 14:35:19 +0300	[thread overview]
Message-ID: <ae1ed260-e6b9-8ed0-931d-d25c3cdf1796@virtuozzo.com> (raw)
In-Reply-To: <efe8d83b-6c4c-a919-44bd-8c9dbdde55c6@redhat.com>

27.05.2020 00:34, Eric Blake wrote:
> On 5/25/20 5:08 AM, Vladimir Sementsov-Ogievskiy wrote:
>> Now, when we are not more paying extra code for coroutine wrappers,
>> there no more sence in extra indirection layer: bdrv_prwv(). Let's drop
>> it and instead genereate pure bdrv_preadv() and bdrv_pwritev().
> 
> Typos and grammar; I suggest:
> 
> Now that we are not maintaining boilerplate code for coroutine wrappers, there is no more sense in keeping the extra indirection layer of bdrv_prwv().  Let's drop it and instead generate pure bdrv_preadv() and bdrv_pwritev().
> 
>>
>> Currently, bdrv_pwritev() and bdrv_preadv() are returning bytes on
>> success, auto generated functions will instead return zero, as their
>> _co_ prototype. Still, it's simple to make the conversion safe: the
>> only external user of bdrv_pwritev() is test-bdrv-drain, and it is
>> comfortable enough with bdrv_co_pwritev() instead. So prototypes are
>> moved to local block/coroutines.h. Next, the only internal use is
>> bdrv_pread() and bdrv_pwrite(), which are modified to return bytes on
>> success.
> 
> Does returning bytes on success buy us anything useful?  We don't allow partial success, so blindly returning 0 on success is no less useful. True, we'd have to audit callers to make sure we aren't doing an inadvertent semantic change.

Not so simple.. Seems we have 151 calls in 23 files:

# git grep -l '\(bdrv_pread\|bdrv_pwrite\)\>' '*.[hc]' | wc -l
23
# git grep '\(bdrv_pread\|bdrv_pwrite\)\>' '*.[hc]' | wc -l
151

Amyway, let it be another series. And such series should probably change most of calls to _co_ variants.

> 
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>   block/coroutines.h      | 10 ++++-----
>>   include/block/block.h   |  2 --
>>   block/io.c              | 49 ++++++++---------------------------------
>>   tests/test-bdrv-drain.c |  2 +-
>>   4 files changed, 15 insertions(+), 48 deletions(-)
>>
> 
> At any rate, I think this patch is reasonable.
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 


-- 
Best regards,
Vladimir


  reply	other threads:[~2020-05-27 11:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 10:07 [PATCH v4 0/5] coroutines: generate wrapper code Vladimir Sementsov-Ogievskiy
2020-05-25 10:07 ` [PATCH v4 1/5] block/io: refactor coroutine wrappers Vladimir Sementsov-Ogievskiy
2020-05-26 19:24   ` Eric Blake
2020-05-25 10:07 ` [PATCH v4 2/5] block: declare some coroutine functions in block/coroutines.h Vladimir Sementsov-Ogievskiy
2020-05-26 19:50   ` Eric Blake
2020-05-25 10:07 ` [PATCH v4 3/5] block: generate coroutine-wrapper code Vladimir Sementsov-Ogievskiy
2020-05-26 20:51   ` [PATCH] fixup! " Eric Blake
2020-05-26 21:30   ` [PATCH v4 3/5] " Eric Blake
2020-05-27 11:24     ` Vladimir Sementsov-Ogievskiy
2020-05-25 10:08 ` [PATCH v4 4/5] block: drop bdrv_prwv Vladimir Sementsov-Ogievskiy
2020-05-26 21:34   ` Eric Blake
2020-05-27 11:35     ` Vladimir Sementsov-Ogievskiy [this message]
2020-05-25 10:08 ` [PATCH v4 5/5] block/io: refactor save/load vmstate Vladimir Sementsov-Ogievskiy
2020-05-26 21:36   ` Eric Blake
2020-05-25 13:14 ` [PATCH v4 0/5] coroutines: generate wrapper code no-reply
2020-05-25 13:48   ` Vladimir Sementsov-Ogievskiy
2020-05-26 20:42     ` Eric Blake

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=ae1ed260-e6b9-8ed0-931d-d25c3cdf1796@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).