From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WETvf-0005On-Qp for qemu-devel@nongnu.org; Fri, 14 Feb 2014 20:20:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WETvZ-0004xB-Br for qemu-devel@nongnu.org; Fri, 14 Feb 2014 20:20:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WETvZ-0004x7-2H for qemu-devel@nongnu.org; Fri, 14 Feb 2014 20:20:21 -0500 Message-ID: <52FEC161.9060501@redhat.com> Date: Sat, 15 Feb 2014 02:22:41 +0100 From: Max Reitz MIME-Version: 1.0 References: <1392242799-16364-1-git-send-email-benoit.canet@irqsave.net> <1392242799-16364-3-git-send-email-benoit.canet@irqsave.net> In-Reply-To: <1392242799-16364-3-git-send-email-benoit.canet@irqsave.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V17 02/12] quorum: Create BDRVQuorumState and BlkDriver and do init. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , stefanha@redhat.com On 12.02.2014 23:06, Beno=C3=AEt Canet wrote: > From: Beno=C3=AEt Canet > > Create the structure holding the quorum settings and write the minimal = block > driver instanciation boilerplate. > > Signed-off-by: Benoit Canet > Reviewed-by: Max Reitz > --- > block/quorum.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/block/quorum.c b/block/quorum.c > index 950f5cc..36c5bb8 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -15,6 +15,23 @@ > =20 > #include "block/block_int.h" > =20 > +/* the following structure holds the state of one quorum instance */ > +typedef struct BDRVQuorumState { > + BlockDriverState **bs; /* children BlockDriverStates */ > + int num_children; /* children count */ > + 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 > + * Writes are mirrored on two children devi= ces. > + * On reads the two children devices conten= ts are Probably better with apostrophe: "children devices' contents". > + * compared and when a difference is spotte= d its Since we're not rooting for an error, I'd prefer an "if" instead of "when= ". > + * location is printed and the code abort. "aborts" Reviewed-by: Max Reitz > + * It is useful to debug other block driver= s by > + * comparing them with a reference one. > + */ > +} BDRVQuorumState; > + > typedef struct QuorumAIOCB QuorumAIOCB; > =20 > /* Quorum will create one instance of the following structure per ope= ration it > @@ -51,3 +68,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);