From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGpRF-000197-3a for qemu-devel@nongnu.org; Thu, 20 Oct 2011 06:01:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGpR9-0003gY-Q8 for qemu-devel@nongnu.org; Thu, 20 Oct 2011 06:01:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGpR9-0003gU-FZ for qemu-devel@nongnu.org; Thu, 20 Oct 2011 06:01:19 -0400 Message-ID: <4E9FF218.7010208@redhat.com> Date: Thu, 20 Oct 2011 12:04:08 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1319036398-14320-1-git-send-email-pbonzini@redhat.com> <1319036398-14320-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1319036398-14320-8-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 7/8] block: change flush to co_flush List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com Am 19.10.2011 16:59, schrieb Paolo Bonzini: > Since coroutine operation is now mandatory, convert all bdrv_flush > implementations to coroutines. For qcow2, this means taking the lock. > Other implementations are simpler and just forward bdrv_flush to the > underlying protocol, so they can avoid the lock. > > The bdrv_flush callback is then unused and can be eliminated. > > Signed-off-by: Paolo Bonzini > diff --git a/block/qcow.c b/block/qcow.c > index f93e3eb..61f73d6 100644 > --- a/block/qcow.c > +++ b/block/qcow.c > @@ -781,10 +781,9 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, > return 0; > } > > -static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs, > - BlockDriverCompletionFunc *cb, void *opaque) > +static coroutine_fn int qcow_co_flush(BlockDriverState *bs) > { > - return bdrv_aio_flush(bs->file, cb, opaque); > + return bdrv_co_flush(bs->file); > } > > static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) > @@ -824,9 +823,9 @@ static BlockDriver bdrv_qcow = { > .bdrv_is_allocated = qcow_is_allocated, > .bdrv_set_key = qcow_set_key, > .bdrv_make_empty = qcow_make_empty, > - .bdrv_co_readv = qcow_co_readv, > - .bdrv_co_writev = qcow_co_writev, > - .bdrv_aio_flush = qcow_aio_flush, > + .bdrv_co_readv = qcow_co_readv, > + .bdrv_co_writev = qcow_co_writev, > + .bdrv_co_flush = qcow_co_flush, > .bdrv_write_compressed = qcow_write_compressed, > .bdrv_get_info = qcow_get_info, Please don't add new tabs, use spaces instead. (Same thing in other drivers) The logic looks good to me. Kevin