From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X93rX-0008Tr-AT for qemu-devel@nongnu.org; Sun, 20 Jul 2014 23:02:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X93rR-0000pl-CE for qemu-devel@nongnu.org; Sun, 20 Jul 2014 23:02:03 -0400 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]:53160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X93rR-0000mz-3U for qemu-devel@nongnu.org; Sun, 20 Jul 2014 23:01:57 -0400 Received: by mail-pd0-f170.google.com with SMTP id g10so8404122pdj.29 for ; Sun, 20 Jul 2014 20:01:55 -0700 (PDT) Date: Mon, 21 Jul 2014 11:01:53 +0800 From: Liu Yuan Message-ID: <20140721030153.GA4817@ubuntu-trusty> References: <1405597808-15975-1-git-send-email-namei.unix@gmail.com> <53C922BD.20408@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53C922BD.20408@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block/quorum: implement .bdrv_co_get_block_status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Benoit Canet On Fri, Jul 18, 2014 at 03:35:57PM +0200, Paolo Bonzini wrote: > Il 17/07/2014 13:50, Liu Yuan ha scritto: > > - allow drive-mirror to create sprase mirror on images like qcow2 > > - allow qemu-img map to work as expected on quorum driver > > > > Cc: Benoit Canet > > Cc: Kevin Wolf > > Cc: Stefan Hajnoczi > > Signed-off-by: Liu Yuan > > --- > > block/quorum.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/block/quorum.c b/block/quorum.c > > index ebf5c71..f0d0a98 100644 > > --- a/block/quorum.c > > +++ b/block/quorum.c > > @@ -780,6 +780,21 @@ static coroutine_fn int quorum_co_flush(BlockDriverState *bs) > > return result; > > } > > > > +static int64_t coroutine_fn quorum_co_get_block_status(BlockDriverState *bs, > > + int64_t sector_num, > > + int nb_sectors, > > + int *pnum) > > +{ > > + BDRVQuorumState *s = bs->opaque; > > + BlockDriverState *child_bs = s->bs[0]; > > + > > + if (child_bs->drv->bdrv_co_get_block_status) > > + return child_bs->drv->bdrv_co_get_block_status(child_bs, sector_num, > > + nb_sectors, pnum); > > Is this "if" necessary? Yes, otherwise bdrv_get_block_status() will be called multiple times and the result for qcow2 won't return desired value im my test. Or we can simply call bdrv_get_block_status() plus some tricks? > > > + return bdrv_get_block_status(child_bs, sector_num, nb_sectors, pnum); > > Also, the definition of BDRV_BLOCK_OFFSET_VALID explicitly refers to > bs->file, so you probably have to exclude it from the result as well as > BDRV_BLOCK_RAW. > Thanks for reminding. Yuan