diff mbox

[RFC,V3,4/9] quorum: Add quorum_getlength().

Message ID 1344953651-16622-5-git-send-email-benoit@irqsave.net
State New
Headers show

Commit Message

Benoit Canet Aug. 14, 2012, 2:14 p.m. UTC
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/quorum.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Eric Blake Aug. 14, 2012, 4:08 p.m. UTC | #1
On 08/14/2012 08:14 AM, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block/quorum.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/block/quorum.c b/block/quorum.c
> index f228428..a3f16ed 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -162,12 +162,21 @@ static void quorum_close(BlockDriverState *bs)
>      g_free(s->bs);
>  }
>  
> +static int64_t quorum_getlength(BlockDriverState *bs)
> +{
> +    BDRVQuorumState *s = bs->opaque;
> +
> +    return bdrv_getlength(s->bs[0]);

Is this implementation right?  Shouldn't this be a quorum decision,
where all s->bs[...] elements have to agree on the same size, or even
where they can differ on size, as long as all files with larger size
have unallocated holes past the size of the smaller member?
Benoît Canet Aug. 16, 2012, 1:18 p.m. UTC | #2
Le Tuesday 14 Aug 2012 à 10:08:24 (-0600), Eric Blake a écrit :
> On 08/14/2012 08:14 AM, Benoît Canet wrote:
> > Signed-off-by: Benoit Canet <benoit@irqsave.net>
> > ---
> >  block/quorum.c |    9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/block/quorum.c b/block/quorum.c
> > index f228428..a3f16ed 100644
> > --- a/block/quorum.c
> > +++ b/block/quorum.c
> > @@ -162,12 +162,21 @@ static void quorum_close(BlockDriverState *bs)
> >      g_free(s->bs);
> >  }
> >  
> > +static int64_t quorum_getlength(BlockDriverState *bs)
> > +{
> > +    BDRVQuorumState *s = bs->opaque;
> > +
> > +    return bdrv_getlength(s->bs[0]);
> 
> Is this implementation right?  Shouldn't this be a quorum decision,
> where all s->bs[...] elements have to agree on the same size, or even
> where they can differ on size, as long as all files with larger size
> have unallocated holes past the size of the smaller member?

You are right.

I have trouble figuring how it would work with differents sizes.
Requiring quorum decision on the same size seems the best solutions
I will implement it.

Benoît

> 
> -- 
> Eric Blake   eblake@redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
diff mbox

Patch

diff --git a/block/quorum.c b/block/quorum.c
index f228428..a3f16ed 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -162,12 +162,21 @@  static void quorum_close(BlockDriverState *bs)
     g_free(s->bs);
 }
 
+static int64_t quorum_getlength(BlockDriverState *bs)
+{
+    BDRVQuorumState *s = bs->opaque;
+
+    return bdrv_getlength(s->bs[0]);
+}
+
 static BlockDriver bdrv_quorum = {
     .format_name        = "quorum",
     .protocol_name      = "quorum",
 
     .instance_size      = sizeof(BDRVQuorumState),
 
+    .bdrv_getlength     = quorum_getlength,
+
     .bdrv_file_open     = quorum_open,
     .bdrv_close         = quorum_close,
 };