> On Wed, Nov 9, 2022 at 1:24 PM Emanuele Giuseppe Esposito
> wrote:
>>>> What I do know is that it's extremely confusing to understand if a
>>>> function that is *not* marked as coroutine_fn is actually being called
>>>> also from coroutines or not.
&
block_copy_reset_unallocated and block_copy_is_cluster_allocated are
only called by backup_run, a corotuine_fn itself.
Same applies to block_copy_block_status, called by
block_copy_dirty_clusters.
Therefore mark them as coroutine too.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block
It is always called in coroutine_fn callbacks, therefore
it can directly call bdrv_co_create().
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c| 6 --
include/block/block-global-state.h | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a
vmdk_co_create_opts() is a coroutine_fn, and calls vmdk_co_do_create()
which in turn can call two callbacks: vmdk_co_create_opts_cb and
vmdk_co_create_cb.
Mark all these functions as coroutine_fn, since vmdk_co_create_opts()
is the only caller.
Signed-off-by: Emanuele Giuseppe Esposito
graph rdlock to the
coroutine case.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 74 -
1 file changed, 36 insertions(+), 38 deletions(-)
diff --git a/block.c b/block.c
index 577639c7e0..375c8056a3 100644
--- a/block.c
+++ b
Delete the if case and make sure it won't be called again
in coroutines.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 37 -
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/block.c b/block.c
index dcac28756c..7a4ce7948c 100644
There are probably more missing, but right now it is necessary that
we extend coroutine_fn to block{allock/status}_to_extents, because
they use bdrv_* functions calling the generated_co_wrapper API, which
checks for the qemu_in_coroutine() case.
Signed-off-by: Emanuele Giuseppe Esposito
---
nbd
Avoid mixing bdrv_* functions with blk_*, so create blk_* counterparts
for:
- bdrv_block_status_above
- bdrv_is_allocated_above
Note that these functions will take the rdlock, so they must always run
in a coroutine.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c
redhat.com>
Emanuele
---
v3:
* Remove patch 1, base on kevin "drain semplification serie"
v2:
* clarified commit message in patches 2/3/6 on why we add coroutine_fn
Emanuele Giuseppe Esposito (8):
block-copy: add missing coroutine_fn annotations
nbd/server.c: add missing coroutin
Some functions check if they are running in a coroutine, calling
the coroutine callback directly if it's the case.
Except that no coroutine calls such functions, therefore that case
can be removed.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/dirty-bitmap.c
ock: Simplify drain".
>
> Based-on: <20221108123738.530873-1-kw...@redhat.com>
>
> Emanuele
> ---
> v3:
> * Remove patch 1, base on kevin "drain semplification serie"
>
> v2:
> * clarified commit message in patches 2/3/6 on why we add coroutine_fn
Extend the regex to cover also return type, pointers included.
This implies that the value returned by the function cannot be
a simple "int" anymore, but the custom return type.
Therefore remove poll_state->ret and instead use a per-function
custom "ret" field.
Signed-of
in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito
---
nbd/server.c | 21 -
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index
suspend (or in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-copy.c | 15 +--
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/block/block-copy.c b/block/block
suspend (or in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/vmdk.c | 36 +++-
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/block/vmdk.c b/block
redhat.com>
Emanuele
---
v4:
* use v2 commit messages
* introduce generated_co_wrapper_simple to simplify patches
v3:
* Remove patch 1, base on kevin "drain semplification serie"
v2:
* clarified commit message in patches 2/3/6 on why we add coroutine_fn
Emanuele Giuseppe Esposito (11
functions will be
substituted on g_c_w_simple.
Signed-off-by: Emanuele Giuseppe Esposito
---
include/block/block-common.h | 1 +
scripts/block-coroutine-wrapper.py | 87 ++
2 files changed, 66 insertions(+), 22 deletions(-)
diff --git a/include/block/block
ain loop.
Signed-off-by: Emanuele Giuseppe Esposito
---
scripts/block-coroutine-wrapper.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/block-coroutine-wrapper.py
b/scripts/block-coroutine-wrapper.py
index f88ef53964..0f842386d4 100644
--- a/scripts/bl
It is always called in coroutine_fn callbacks, therefore
it can directly call bdrv_co_create().
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c| 6 --
include/block/block-global-state.h | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a
Call two different functions depending on whether bdrv_create
is in coroutine or not, following the same pattern as
generated_co_wrapper functions.
This allows to also call the coroutine function directly,
without using CreateCo or relying in bdrv_create().
Signed-off-by: Emanuele Giuseppe
This function is never called in coroutine context, therefore
instead of manually creating a new coroutine, delegate it to the
block-coroutine-wrapper script, defining it as g_c_w_simple.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c| 38
Avoid mixing bdrv_* functions with blk_*, so create blk_* counterparts
for:
- bdrv_block_status_above
- bdrv_is_allocated_above
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c | 21 +
block/commit.c| 4 ++--
include/sysemu
ed to
g_c_w_simple.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/dirty-bitmap.c | 88 +---
block/meson.build| 1 +
include/block/block-common.h | 5 +-
include/block/block-io.h | 9 +++-
include/block/dirty-bitmap.h | 10 +++-
5
56527-1-eespo...@redhat.com>
Thank you,
Emanuele
Emanuele Giuseppe Esposito (19):
graph-lock: introduce BdrvGraphRWlock structure
async: register/unregister aiocontext in graph lock list
block.c: wrlock in bdrv_replace_child_noperm
block: remove unnecessary assert_bdrv_graph_writable()
bl
56527-1-eespo...@redhat.com>
Thank you,
Emanuele
Emanuele Giuseppe Esposito (19):
graph-lock: introduce BdrvGraphRWlock structure
async: register/unregister aiocontext in graph lock list
block.c: wrlock in bdrv_replace_child_noperm
block: remove unnecessary assert_bdrv_graph_writable()
bl
The only caller of this function is nbd_do_establish_connection, a
generated_co_wrapper that already take the graph read lock.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/nbd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/nbd.c b/block/nbd.c
index 7d485c86d2..5cad58aaf6
-by: Emanuele Giuseppe Esposito
---
block/io.c | 2 ++
include/block/block_int-common.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/block/io.c b/block/io.c
index 0bf3919939..c9b451fecd 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2633,6 +2633,7 @@ bdrv_co_readv_vmst
The only callers of these functions are the respective
generated_co_wrapper, and they already take the lock.
Protecting bdrv_co_{check/invalidate_cache}() implies that
BlockDriver->bdrv_co_{check/invalidate_cache}() is always called with
graph rdlock taken.
Signed-off-by: Emanuele Giuse
We don't protect bdrv->aio_context with the graph rwlock,
so these assertions are not needed
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/block.c b/block.c
index 4ef537a9f2..afab74d4da 100644
--- a/block.c
+++ b/block.c
@@
BlockDriver
callbacks always called with graph rdlock taken:
- bdrv_co_pdiscard
- bdrv_aio_pdiscard
- bdrv_co_pdiscard_snapshot
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c| 1 +
block/io.c | 2 ++
include/block/block_int-common.h | 3 +++
3 files
Add/remove the AioContext in aio_context_list in graph-lock.c only when
it is being effectively created/destroyed.
Signed-off-by: Emanuele Giuseppe Esposito
---
util/async.c | 4
util/meson.build | 1 +
2 files changed, 5 insertions(+)
diff --git a/util/async.c b/util/async.c
index
:
- bdrv_aio_pwritev
- bdrv_co_writev
- bdrv_co_pwritev
- bdrv_co_pwritev_part
- bdrv_co_pwritev_compressed
- bdrv_co_pwritev_compressed_part
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c| 1 +
block/block-copy.c | 8 ++--
block/io.c
Just a wrapper to simplify what is available to the struct AioContext.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/graph-lock.c | 59 ++
include/block/aio.h| 12
include/block/graph-lock.h | 1 +
3 files changed, 48
Similar to the implementation in lockable.h, implement macros to
automatically take and release the rdlock.
Create the empty GraphLockable struct only to use it as a type for
G_DEFINE_AUTOPTR_CLEANUP_FUNC.
Signed-off-by: Emanuele Giuseppe Esposito
---
include/block/graph-lock.h | 35
other generated_co_wrappers:
blk_co_pread
blk_co_preadv
blk_co_preadv_part
Protecting bdrv_driver_preadv() implies that the following BlockDriver
callbacks always called with graph rdlock taken:
- bdrv_co_preadv_part
- bdrv_co_preadv
- bdrv_aio_preadv
- bdrv_co_readv
Signed-off-by: Emanuele Giuseppe
always called with graph rdlock taken:
- bdrv_co_flush
- bdrv_co_flush_to_os
- bdrv_co_flush_to_disk
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c| 3 ++-
block/io.c | 1 +
include/block/block_int-common.h | 6 ++
3 files changed, 9
The only callers are other callback functions that already run with the
graph rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/io.c | 2 ++
include/block/block_int-common.h | 3 +++
2 files changed, 5 insertions(+)
diff --git a/block/io.c b/block/io.c
This annotation will be used to distinguish the blk_* API from the
bdrv_* API in block-gen.c. The reason for this distinction is that
blk_* API eventually result in always calling bdrv_*, which has
implications when we introduce the read graph lock.
Signed-off-by: Emanuele Giuseppe Esposito
assume that the graph rdlock is taken at the coroutine
creation, i.e. in g_c_w or in specific coroutines (right now we just
consider the g_c_w case).
All the blk_co_* are responsible of taking the rdlock (at this point is still a
TBD).
Suggested-by: Kevin Wolf
Signed-off-by: Emanuele Giuseppe
56527-1-eespo...@redhat.com>
Thank you,
Emanuele
Emanuele Giuseppe Esposito (19):
graph-lock: introduce BdrvGraphRWlock structure
async: register/unregister aiocontext in graph lock list
block.c: wrlock in bdrv_replace_child_noperm
block: remove unnecessary assert_bdrv_graph_writable()
bl
The only callers are other callback functions that already run with the graph
rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 1 +
include/block/block_int-common.h | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/block.c b
ate() is always called with
graph rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c| 1 +
block/io.c | 1 +
include/block/block_int-common.h | 2 ++
3 files changed, 4 insertions(+)
diff --git a/block/block-backend.c b/block/bl
Both functions are only called by Job->run() callbacks, therefore
they must take the lock in the *_run() implementation.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/amend.c| 1 +
block/create.c | 1 +
include/block/block_int-common.h | 2 ++
3 fi
y traverse the BlockDriverState graph, therefore
they need to be protected with the rdlock.
Based-on: <20221116134850.3051419-1-eespo...@redhat.com>
Thank you,
Emanuele
Emanuele Giuseppe Esposito (6):
block: assert that bdrv_co_create is always called with graph rdlock
taken
bl
Remove the old assert_bdrv_graph_writable, and replace it with
the new version using graph-lock API.
See the function documentation for more information.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c| 4 ++--
block/graph-lock.c | 11
ver->bdrv_co_create_opts
is always called with graph rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 1 +
include/block/block_int-common.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/block.c b/block.c
index c7611bed9e..e54ed300d7 100644
--- a/block.c
Already protected by bdrv_co_pwrite callers.
Protecting bdrv_co_do_pwrite_zeroes() implies that
BlockDriver->bdrv_co_pwrite_zeroes() is always called with
graph rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/io.c | 3 +++
include/block/block_
called too with rdlock taken).
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c| 1 +
block/io.c | 1 +
include/block/block_int-common.h | 5 +++--
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/block-backend.c b/block
The only non-protected caller is convert_co_copy_range(), all other
callers are BlockDriver callbacks that already take the rdlock.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c| 2 ++
block/io.c | 5 +
include/block/block_int-common.h
we transfer the count to a global shared counter
so that the writer is always aware of all readers.
Co-developed-with: Emanuele Giuseppe Esposito
Signed-off-by: Kevin Wolf
Signed-off-by: Paolo Bonzini
---
block/graph-lock.c | 221 +
block/meson.buil
Protect the main function where graph is modified.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 6 --
include/block/block_int-common.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index d3e168408a..4ef537a9f2
() implies that
BlockDriver->bdrv_co_block_status() is always called with
graph rdlock taken.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/backup.c | 3 +++
block/block-backend.c| 2 ++
block/block-copy.c | 2 ++
block/i
The only callers are the respective bdrv_*_dirty_bitmap() functions that
take care of creating a new coroutine (that already takes the graph
rdlock).
Signed-off-by: Emanuele Giuseppe Esposito
---
block/dirty-bitmap.c | 2 ++
include/block/block_int-common.h | 2 ++
2 files changed
k_plug a generated_co_wrapper_simple, so that
it always creates a new coroutine, and then make bdrv_plug
coroutine_fn.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c | 5 +++--
block/io.c| 5 +++--
include/block/block-io.h | 3 ++-
include/block/b
Just omit the various 'return' when the return type is
void.
Signed-off-by: Emanuele Giuseppe Esposito
---
scripts/block-coroutine-wrapper.py | 19 ++-
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/block-coroutine-wrapper.py
b/scripts/block
ame name.
Unfortunately we cannot use a generated_co_wrapper_simple,
because the function is called by mixed functions that run both
in coroutine and non-coroutine context (for example blkdebug_open).
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 4 +++-
bl
s run in a coroutine.
Based-on: <20221116135331.3052923-1-eespo...@redhat.com>
Thank you,
Emanuele
Emanuele Giuseppe Esposito (15):
block/qed: add missing graph rdlock in qed_need_check_timer_entry
block: rename refresh_total_sectors in bdrv_refresh_total_sectors
block-backend: use
Giuseppe Esposito
---
block/block-backend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 6f0dd15808..4af9a3179e 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1253,7 +1253,7 @@ static int
oContext lock.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 29 -
block/block-backend.c | 12
block/commit.c| 4 ++--
block/meson.build | 1 +
block/
ry place it needs
to be, we will poll using AIO_WAIT_WHILE_UNLOCKED and remove
the AioContext lock.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 5 +++--
block/block-backend.c | 5 +++--
block/io.c| 12 ++--
bl
graph rdlock.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/qed.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/qed.c b/block/qed.c
index c2691a85b1..778b23d0f6 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -282,11 +282,13 @@ static void coroutine_fn
ame name.
Unfortunately we cannot use a generated_co_wrapper_simple,
because the function is called by mixed functions that run both
in coroutine and non-coroutine context (for example block_load
in migration/block.c).
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c
wrapper with the same name that will take care of
always calling the function in a coroutine.
This is a generated_co_wrapper_simple callback, which means
it assumes that bdrv_get_allocated_file_size is never caled in a coroutine
context.
Signed-off-by: Emanuele Giuseppe Esposito
---
_eject a generated_co_wrapper_simple, so that
it always creates a new coroutine, and then make bdrv_eject
coroutine_fn.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 3 ++-
block/block-backend.c | 5 +++--
block/copy-on-read.c | 2 +-
block/filter-co
unplug a generated_co_wrapper_simple, so that
it always creates a new coroutine, and then make bdrv_unplug
coroutine_fn.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c | 5 +++--
block/io.c| 5 +++--
include/block/block-io.h | 3 +--
inclu
Name is not right, since we are going to convert this in
a generated_co_wrapper.
No functional change intended.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 8
block/io.c | 8 +---
include/block/block_int-io.h | 2 +-
3 files
Since these functions alwayas run in coroutine context, adjust
their name to include "_co_", just like all other BlockDriver callbacks.
No functional change intended.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 32 ++---
block/
medium a generated_co_wrapper_simple, so that
it always creates a new coroutine, and then make bdrv_lock_medium
coroutine_fn.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 3 ++-
block/block-backend.c | 5 +++--
block/copy-on-read.c | 2 +
In some places we are sure we are always running in a
coroutine, therefore it's useless to call the generated_co_wrapper,
instead call directly the _co_ function.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-backend.c | 6 +++---
block/copy-on-read.c | 2 +-
block
Am 17/11/2022 um 20:27 schrieb David Hildenbrand:
> On 11.11.22 16:47, Emanuele Giuseppe Esposito wrote:
>> Using the new accel-blocker API, mark where ioctls are being called
>> in KVM. Next, we will implement the critical section that will take
>> care of performing m
Am 18/11/2022 um 11:57 schrieb Paolo Bonzini:
> On 11/16/22 15:07, Emanuele Giuseppe Esposito wrote:
>> Here we introduce generated_co_wrapper_simple, a simplification of
>> g_c_w that
>> only considers the case where the caller is not in a coroutine.
>> This simplifi
Am 18/11/2022 um 20:05 schrieb Kevin Wolf:
> Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben:
>> These functions end up calling bdrv_common_block_status_above(), a
>> generated_co_wrapper function.
>> In addition, they also happen to be always called
Am 21/11/2022 um 09:32 schrieb Emanuele Giuseppe Esposito:
>
>
> Am 18/11/2022 um 20:05 schrieb Kevin Wolf:
>> Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben:
>>> These functions end up calling bdrv_common_block_status_above(), a
>>> gene
Am 21/11/2022 um 12:50 schrieb Kevin Wolf:
> Am 21.11.2022 um 09:51 hat Emanuele Giuseppe Esposito geschrieben:
>>
>>
>> Am 21/11/2022 um 09:32 schrieb Emanuele Giuseppe Esposito:
>>>
>>>
>>> Am 18/11/2022 um 20:05 schrieb Kevin Wolf:
>>&g
rotect the block layer with a rwlock: part 3
Thank you,
Emanuele
Am 16/11/2022 um 15:07 schrieb Emanuele Giuseppe Esposito:
> Please read "Protect the block layer with a rwlock: part 1" and
> "Protect the block layer with a rwlock: part 2" for an
> additional intro
rotect the block layer with a rwlock: part 3
Thank you,
Emanuele
Am 16/11/2022 um 14:48 schrieb Emanuele Giuseppe Esposito:
> This serie is the first of four series that aim to introduce and use a new
> graph rwlock in the QEMU block layer.
> The aim is to replace the current AioContext
rotect the block layer with a rwlock: part 3
Thank you,
Emanuele
Am 16/11/2022 um 14:53 schrieb Emanuele Giuseppe Esposito:
> Please read "Protect the block layer with a rwlock: part 1" for an additional
> introduction and aim of this series.
>
> This second part aim
Am 21/11/2022 um 16:30 schrieb Kevin Wolf:
> Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben:
>> Basically BdrvPollCo->bs is only used by bdrv_poll_co(), and the
>> functions that it uses are both using bdrv_get_aio_context, that
>> defaults to qemu_ge
Am 21/11/2022 um 17:01 schrieb Kevin Wolf:
> Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben:
>> These functions end up calling bdrv_create() implemented as
>> generated_co_wrapper
>> functions.
>> In addition, they also happen to be always
Am 22/11/2022 um 09:58 schrieb Kevin Wolf:
> Am 16.11.2022 um 13:22 hat Emanuele Giuseppe Esposito geschrieben:
>> It is always called in coroutine_fn callbacks, therefore
>> it can directly call bdrv_co_create().
>>
>> Signed-off-by: Emanuele Giuseppe E
ppers that take care of directly
calling the same coroutine functions called in the g_c_w.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/io.c | 64 ++--
include/block/block-io.h | 15 ++
2 files changed, 76 insertions(+), 3 deletion
This function is never called in coroutine context, therefore
instead of manually creating a new coroutine, delegate it to the
block-coroutine-wrapper script, defining it as g_c_w_simple.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Kevin Wolf
---
block.c
We know that the string will stay around until the function
returns, and the parameter of drv->bdrv_co_create_opts is const char*,
so it must not be modified either.
Suggested-by: Kevin Wolf
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c | 7 ++-
1 file changed, 2 insertions(+)
Call two different functions depending on whether bdrv_create
is in coroutine or not, following the same pattern as
generated_co_wrapper functions.
This allows to also call the coroutine function directly,
without using CreateCo or relying in bdrv_create().
Signed-off-by: Emanuele Giuseppe
functions will be
substituted on g_c_w_simple.
Signed-off-by: Emanuele Giuseppe Esposito
---
include/block/block-common.h | 1 +
scripts/block-coroutine-wrapper.py | 105 -
2 files changed, 75 insertions(+), 31 deletions(-)
diff --git a/include/block/block
suspend (or in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Paolo Bonzini
---
block/block-copy.c | 21 -
include/block/block-copy.h | 5 +++--
2 files
in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Kevin Wolf
Reviewed-by: Paolo Bonzini
---
nbd/server.c | 29 -
1 file changed, 16 insertions(+), 13
context.
Signed-off-by: Emanuele Giuseppe Esposito
---
include/block/block-common.h | 11 +++
1 file changed, 11 insertions(+)
diff --git a/include/block/block-common.h b/include/block/block-common.h
index 297704c1e9..24de1d63fd 100644
--- a/include/block/block-common.h
+++ b/include/block
drain"
v4:
* use v2 commit messages
* introduce generated_co_wrapper_simple to simplify patches
v3:
* Remove patch 1, base on kevin "drain semplification serie"
v2:
* clarified commit message in patches 2/3/6 on why we add coroutine_fn
Emanuele Giuseppe Esposito (15)
bdrv_co_common_block_status_above() to avoid using a g_c_w.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Paolo Bonzini
---
block/block-backend.c | 21
block/commit.c| 4 ++--
include/sysemu/block-backend-io.h | 9 +
nbd/server.c
suspend (or in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Paolo Bonzini
Reviewed-by: Kevin Wolf
---
block/vmdk.c | 36 +++-
1 file changed, 19 insertions
ed to
g_c_w_simple.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Kevin Wolf
---
block/dirty-bitmap.c | 88 +---
block/meson.build| 1 +
include/block/block-common.h | 5 +-
include/block/block-io.h | 9 +++-
include/block/
ain loop.
Signed-off-by: Emanuele Giuseppe Esposito
---
scripts/block-coroutine-wrapper.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/block-coroutine-wrapper.py
b/scripts/block-coroutine-wrapper.py
index 2fa3d01898..7e8f2da84b 100644
--- a/scripts/bl
It is always called in coroutine_fn callbacks, therefore
it can directly call bdrv_co_create().
Rename it to bdrv_co_create_file too.
Signed-off-by: Emanuele Giuseppe Esposito
---
block.c| 5 +++--
block/crypto.c | 2 +-
block/parallels.c
Extend the regex to cover also return type, pointers included.
This implies that the value returned by the function cannot be
a simple "int" anymore, but the custom return type.
Therefore remove poll_state->ret and instead use a per-function
custom "ret" field.
Signed-of
, and default to the main loop if no
BlockDriverState is passed as parameter.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/block-gen.h | 6 +++---
scripts/block-coroutine-wrapper.py | 14 +++---
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/block
Am 18/11/2022 um 11:57 schrieb Paolo Bonzini:
> On 11/16/22 15:07, Emanuele Giuseppe Esposito wrote:
>> Here we introduce generated_co_wrapper_simple, a simplification of
>> g_c_w that
>> only considers the case where the caller is not in a coroutine.
>> This simplifi
suspend (or in other words call qemu_coroutine_yield()).
Therefore we need to mark such functions coroutine_fn too.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Paolo Bonzini
Reviewed-by: Kevin Wolf
---
block/block-copy.c | 21 -
include/block/block-copy.h
This function is never called in coroutine context, therefore
instead of manually creating a new coroutine, delegate it to the
block-coroutine-wrapper script, defining it as co_wrapper.
Signed-off-by: Emanuele Giuseppe Esposito
Reviewed-by: Kevin Wolf
---
block.c
In preparation to the incoming new function specifiers,
rename g_c_w with a more meaningful name and document it.
Signed-off-by: Emanuele Giuseppe Esposito
---
block/coroutines.h | 4 +-
docs/devel/block-coroutine-wrapper.rst | 6 +--
include/block/block-common.h
1 - 100 of 1535 matches
Mail list logo