Received: from eggs.gnu.org ([2001:4830:134:3::10]:42220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAfkE-00045h-Ag for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:08:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAfk9-0008Sl-8Z for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:08:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAfk8-0008Se-Vk for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:08:49 -0500 Date: Tue, 4 Feb 2014 14:08:48 +0100 From: Kevin Wolf Message-ID: <20140204130848.GI3384@dhcp-200-207.str.redhat.com> References: <1391464280-25627-1-git-send-email-benoit.canet@irqsave.net> <1391464280-25627-3-git-send-email-benoit.canet@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1391464280-25627-3-git-send-email-benoit.canet@irqsave.net> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V15 02/13] quorum: Create BDRVQuorumState and BlkDriver and do init. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com Am 03.02.2014 um 22:51 hat Beno=EEt Canet geschrieben: > From: Beno=EEt Canet >=20 > Signed-off-by: Benoit Canet > Reviewed-by: Max Reitz > --- > block/quorum.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) >=20 > diff --git a/block/quorum.c b/block/quorum.c > index 17695d6..157efdf 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -15,6 +15,16 @@ > =20 > #include "block/block_int.h" > =20 > +/* the following structure holds the state of one quorum instance */ > +typedef struct { The convention is to have both a struct name and a typedef name (and it should be the same in both places, of course). > + BlockDriverState **bs; /* children BlockDriverStates */ > + int total; /* children count */ num_children? "total" could be anything. > + int threshold; /* if less than threshold children reads ga= ve the > + * same result a quorum error occurs. > + */ > + bool is_blkverify; /* true if the driver is in blkverify mode = */ Can you describe in detail, what blkverify mode is? > +} BDRVQuorumState; > + > typedef struct QuorumAIOCB QuorumAIOCB; > =20 > /* Quorum will create one instance of the following structure per oper= ation it > @@ -37,6 +47,7 @@ typedef struct QuorumSingleAIOCB { > */ > struct QuorumAIOCB { > BlockDriverAIOCB common; > + BDRVQuorumState *bqs; > =20 > /* Request metadata */ > uint64_t sector_num; > @@ -52,3 +63,17 @@ struct QuorumAIOCB { > bool is_read; > int vote_ret; > }; > + > +static BlockDriver bdrv_quorum =3D { > + .format_name =3D "quorum", > + .protocol_name =3D "quorum", > + > + .instance_size =3D sizeof(BDRVQuorumState), > +}; > + > +static void bdrv_quorum_init(void) > +{ > + bdrv_register(&bdrv_quorum); > +} > + > +block_init(bdrv_quorum_init); I suspect that trying to use the driver will cause segfaults in this state (has neither bdrv_open nor bdrv_file_open). But okay, we can live with that. Kevin