qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 24/36] mirror: support querying target file


From: Paolo Bonzini
Subject: [Qemu-devel] [RFC PATCH 24/36] mirror: support querying target file
Date: Fri, 15 Jun 2012 17:05:47 +0200

This lets query-block-jobs retrieve information and statistics on the
mirroring target.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 block/mirror.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/block/mirror.c b/block/mirror.c
index 1ed19a9..4c1582d 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -201,10 +201,21 @@ static void mirror_set_speed(BlockJob *job, int64_t 
speed, Error **errp)
     ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
 }
 
+static void mirror_query(BlockJob *job, BlockJobInfo *info)
+{
+    MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
+
+    info->has_target = true;
+    info->target = g_new0(BlockJobTargetInfo, 1);
+    info->target->info = bdrv_query_info(s->target);
+    info->target->stats = bdrv_query_stats(s->target);
+}
+
 static BlockJobType mirror_job_type = {
     .instance_size = sizeof(MirrorBlockJob),
     .job_type      = "mirror",
     .set_speed     = mirror_set_speed,
+    .query         = mirror_query,
 };
 
 void mirror_start(BlockDriverState *bs, BlockDriverState *target,
-- 
1.7.10.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]