Revision d55dee20
b/block/quorum.c | ||
---|---|---|
595 | 595 |
return &acb->common; |
596 | 596 |
} |
597 | 597 |
|
598 |
static int64_t quorum_getlength(BlockDriverState *bs) |
|
599 |
{ |
|
600 |
BDRVQuorumState *s = bs->opaque; |
|
601 |
int64_t result; |
|
602 |
int i; |
|
603 |
|
|
604 |
/* check that all file have the same length */ |
|
605 |
result = bdrv_getlength(s->bs[0]); |
|
606 |
if (result < 0) { |
|
607 |
return result; |
|
608 |
} |
|
609 |
for (i = 1; i < s->num_children; i++) { |
|
610 |
int64_t value = bdrv_getlength(s->bs[i]); |
|
611 |
if (value < 0) { |
|
612 |
return value; |
|
613 |
} |
|
614 |
if (value != result) { |
|
615 |
return -EIO; |
|
616 |
} |
|
617 |
} |
|
618 |
|
|
619 |
return result; |
|
620 |
} |
|
621 |
|
|
598 | 622 |
static BlockDriver bdrv_quorum = { |
599 | 623 |
.format_name = "quorum", |
600 | 624 |
.protocol_name = "quorum", |
601 | 625 |
|
602 | 626 |
.instance_size = sizeof(BDRVQuorumState), |
603 | 627 |
|
628 |
.bdrv_getlength = quorum_getlength, |
|
629 |
|
|
604 | 630 |
.bdrv_aio_readv = quorum_aio_readv, |
605 | 631 |
.bdrv_aio_writev = quorum_aio_writev, |
606 | 632 |
}; |
Also available in: Unified diff