qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/quorum: implement .bdrv_co_get_block_status
@ 2014-07-17 11:50 Liu Yuan
  2014-07-18  3:11 ` Fam Zheng
  2014-07-18 13:35 ` Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Liu Yuan @ 2014-07-17 11:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Benoit Canet, Stefan Hajnoczi

- allow drive-mirror to create sprase mirror on images like qcow2
- allow qemu-img map to work as expected on quorum driver

Cc: Benoit Canet <benoit@irqsave.net>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
---
 block/quorum.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/block/quorum.c b/block/quorum.c
index ebf5c71..f0d0a98 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -780,6 +780,21 @@ static coroutine_fn int quorum_co_flush(BlockDriverState *bs)
     return result;
 }
 
+static int64_t coroutine_fn quorum_co_get_block_status(BlockDriverState *bs,
+                                                       int64_t sector_num,
+                                                       int nb_sectors,
+                                                       int *pnum)
+{
+    BDRVQuorumState *s = bs->opaque;
+    BlockDriverState *child_bs = s->bs[0];
+
+    if (child_bs->drv->bdrv_co_get_block_status)
+        return child_bs->drv->bdrv_co_get_block_status(child_bs, sector_num,
+                                                       nb_sectors, pnum);
+
+    return bdrv_get_block_status(child_bs, sector_num, nb_sectors, pnum);
+}
+
 static bool quorum_recurse_is_first_non_filter(BlockDriverState *bs,
                                                BlockDriverState *candidate)
 {
@@ -1038,6 +1053,7 @@ static BlockDriver bdrv_quorum = {
     .bdrv_close                         = quorum_close,
 
     .bdrv_co_flush_to_disk              = quorum_co_flush,
+    .bdrv_co_get_block_status           = quorum_co_get_block_status,
 
     .bdrv_getlength                     = quorum_getlength,
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-07-21  3:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-17 11:50 [Qemu-devel] [PATCH] block/quorum: implement .bdrv_co_get_block_status Liu Yuan
2014-07-18  3:11 ` Fam Zheng
2014-07-18  5:52   ` Liu Yuan
2014-07-18 11:10     ` Kevin Wolf
2014-07-18 12:14   ` Eric Blake
2014-07-18 13:35 ` Paolo Bonzini
2014-07-21  3:01   ` Liu Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).