From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WARQO-0008Ls-K9 for qemu-devel@nongnu.org; Mon, 03 Feb 2014 16:51:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WARQH-0008IS-W9 for qemu-devel@nongnu.org; Mon, 03 Feb 2014 16:51:28 -0500 Received: from paradis.irqsave.net ([62.212.105.220]:49084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WARQH-0008I4-HI for qemu-devel@nongnu.org; Mon, 03 Feb 2014 16:51:21 -0500 From: =?UTF-8?q?Beno=C3=AEt=20Canet?= Date: Mon, 3 Feb 2014 22:51:09 +0100 Message-Id: <1391464280-25627-3-git-send-email-benoit.canet@irqsave.net> In-Reply-To: <1391464280-25627-1-git-send-email-benoit.canet@irqsave.net> References: <1391464280-25627-1-git-send-email-benoit.canet@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [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: qemu-devel@nongnu.org Cc: kwolf@redhat.com, =?UTF-8?q?Beno=C3=AEt=20Canet?= , stefanha@redhat.com, mreitz@redhat.com From: Beno=C3=AEt Canet Signed-off-by: Benoit Canet Reviewed-by: Max Reitz --- block/quorum.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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 { + BlockDriverState **bs; /* children BlockDriverStates */ + int total; /* children count */ + int threshold; /* if less than threshold children reads gave= the + * same result a quorum error occurs. + */ + bool is_blkverify; /* true if the driver is in blkverify mode */ +} BDRVQuorumState; + typedef struct QuorumAIOCB QuorumAIOCB; =20 /* Quorum will create one instance of the following structure per operat= ion 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); --=20 1.8.3.2