[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 4/5] block: drop bdrv_prwv
From: |
Eric Blake |
Subject: |
Re: [PATCH v4 4/5] block: drop bdrv_prwv |
Date: |
Tue, 26 May 2020 16:34:57 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
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.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
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 <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
- Re: [PATCH v4 5/5] block/io: refactor save/load vmstate, (continued)
- [PATCH v4 1/5] block/io: refactor coroutine wrappers, Vladimir Sementsov-Ogievskiy, 2020/05/25
- [PATCH v4 2/5] block: declare some coroutine functions in block/coroutines.h, Vladimir Sementsov-Ogievskiy, 2020/05/25
- [PATCH v4 3/5] block: generate coroutine-wrapper code, Vladimir Sementsov-Ogievskiy, 2020/05/25
- [PATCH v4 4/5] block: drop bdrv_prwv, Vladimir Sementsov-Ogievskiy, 2020/05/25
- Re: [PATCH v4 4/5] block: drop bdrv_prwv,
Eric Blake <=
- Re: [PATCH v4 0/5] coroutines: generate wrapper code, no-reply, 2020/05/25