From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF19B-0007JU-1k for qemu-devel@nongnu.org; Thu, 29 Aug 2013 08:16:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF193-00036n-6N for qemu-devel@nongnu.org; Thu, 29 Aug 2013 08:16:20 -0400 Received: from mail6.webfaction.com ([74.55.86.74]:48648 helo=smtp.webfaction.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF192-00035B-Uo for qemu-devel@nongnu.org; Thu, 29 Aug 2013 08:16:13 -0400 Message-ID: <521F3B8A.6000603@ctshepherd.com> Date: Thu, 29 Aug 2013 13:16:10 +0100 From: Charlie Shepherd MIME-Version: 1.0 References: <1376070245-22557-1-git-send-email-charlie@ctshepherd.com> <1376070245-22557-4-git-send-email-charlie@ctshepherd.com> <20130829121137.GA17744@stefanha-thinkpad.redhat.com> In-Reply-To: <20130829121137.GA17744@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, pbonzini@redhat.com, gabriel@kerneis.info, qemu-devel@nongnu.org On 29/08/2013 13:11, Stefan Hajnoczi wrote: > On Fri, Aug 09, 2013 at 07:43:54PM +0200, Charlie Shepherd wrote: >> Signed-off-by: Charlie Shepherd >> --- >> 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)? Yes, later patches do that. It's quite difficult to keep the patches small and separate, so the series tries to keep them compilable, but the annotations will not necessarily be fully consistent until the end of the series. Charlie