From: Stefan Hajnoczi <stefanha@gmail.com>
To: Charlie Shepherd <charlie@ctshepherd.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, gabriel@kerneis.info,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn
Date: Thu, 29 Aug 2013 14:11:37 +0200 [thread overview]
Message-ID: <20130829121137.GA17744@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1376070245-22557-4-git-send-email-charlie@ctshepherd.com>
On Fri, Aug 09, 2013 at 07:43:54PM +0200, Charlie Shepherd wrote:
> Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com>
> ---
> block.c | 8 ++++----
> block/blkdebug.c | 4 ++--
> block/blkverify.c | 4 ++--
> block/bochs.c | 4 ++--
> block/cloop.c | 4 ++--
> block/cow.c | 4 ++--
> block/curl.c | 12 ++++++------
> block/dmg.c | 4 ++--
> block/nbd.c | 6 +++---
> block/parallels.c | 4 ++--
> block/qcow.c | 4 ++--
> block/qcow2.c | 2 +-
> block/qed.c | 4 ++--
> block/raw-posix.c | 20 ++++++++++----------
> block/raw.c | 4 ++--
> block/sheepdog.c | 10 +++++-----
> block/ssh.c | 4 ++--
> block/vdi.c | 4 ++--
> block/vhdx.c | 4 ++--
> block/vmdk.c | 4 ++--
> block/vpc.c | 4 ++--
> block/vvfat.c | 6 +++---
> include/block/block_int.h | 4 ++--
> 23 files changed, 64 insertions(+), 64 deletions(-)
>
> diff --git a/block.c b/block.c
> index 40f73ee..75a1e6b 100644
> --- a/block.c
> +++ b/block.c
> @@ -699,7 +699,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
> /* bdrv_open() with directly using a protocol as drv. This layer is already
> * opened, so assign it to bs (while file becomes a closed BlockDriverState)
> * and return immediately. */
> - if (file != NULL && drv->bdrv_file_open) {
> + if (file != NULL && drv->bdrv_co_file_open) {
> bdrv_swap(file, bs);
> return 0;
> }
> @@ -730,10 +730,10 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
> bs->enable_write_cache = !!(flags & BDRV_O_CACHE_WB);
>
> /* Open the image, either directly or using a protocol */
> - if (drv->bdrv_file_open) {
> + if (drv->bdrv_co_file_open) {
> assert(file == NULL);
> assert(drv->bdrv_parse_filename || filename != NULL);
> - ret = drv->bdrv_file_open(bs, options, open_flags);
> + ret = drv->bdrv_co_file_open(bs, options, open_flags);
> } else {
> if (file == NULL) {
> qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a "
> @@ -744,7 +744,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
> }
> assert(file != NULL);
> bs->file = file;
> - ret = drv->bdrv_open(bs, options, open_flags);
> + ret = drv->bdrv_co_open(bs, options, open_flags);
> }
>
> if (ret < 0) {
bdrv_open_common() needs to be coroutine_fn too. I'm pretty sure
bdrv_open() is called outside coroutine context in some places. How do
you guarantee that it is executed inside a coroutine (a synchronous
wrapper would be necessary)?
Stefan
next prev parent reply other threads:[~2013-08-29 12:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-09 17:43 [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn Charlie Shepherd
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper Charlie Shepherd
2013-08-14 14:21 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create Charlie Shepherd
2013-08-14 14:26 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn Charlie Shepherd
2013-08-29 12:11 ` Stefan Hajnoczi [this message]
2013-08-29 12:16 ` Charlie Shepherd
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous Charlie Shepherd
2013-08-29 12:29 ` Stefan Hajnoczi
2013-08-29 12:33 ` Stefan Hajnoczi
2013-08-29 12:43 ` Charlie Shepherd
2013-09-04 11:39 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions Charlie Shepherd
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 07/15] Call bdrv->open via a synchronous wrapper in block/snapshot.c Charlie Shepherd
2013-08-29 15:14 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 08/15] Convert bdrv_create and associated functions to be coroutine_fn Charlie Shepherd
2013-08-29 15:31 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 09/15] Add a synchronous wrapper bdrv_sync_rwco Charlie Shepherd
2013-08-29 15:32 ` Stefan Hajnoczi
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 10/15] Convert bdrv_read, bdrv_write and associated functions to coroutine functions Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 11/15] Make bdrv_discard coroutine only and add bdrv_sync_discard Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 12/15] Make bdrv_flush coroutine only and add bdrv_sync_flush Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 13/15] Introduce a run_handler function in qemu-img.c Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 14/15] Add coroutine annotations for qemu_co_rwlock_rdlock and qemu_co_rwlock_wrlock Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 15/15] Add coroutine_fn annotations to nbd_co_* functions Charlie Shepherd
2013-08-14 14:14 ` [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn Stefan Hajnoczi
2013-08-29 15:34 ` 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=20130829121137.GA17744@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=charlie@ctshepherd.com \
--cc=gabriel@kerneis.info \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).