Skip to contentSkip to conversation

qapi: Add "backing" to BlockStats

PATCH Applied Fam Zheng 4 participants 4 messages Jan 23, 2014 – Jan 24, 2014 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH v2 1/1 qapi: Add "backing" to BlockStats

Currently there is no way to query BlockStats of the backing chain. This adds "backing" field into BlockStats to make it possible.

The comment of "parent" is reworded.

---
v2: Only add "backing", drop "file".

---
 block/qapi.c     |  5 +++++
 qapi-schema.json | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
block/qapi.c +5 -0
index a32cb79..98b1b83 100644
@@ -318,6 +318,11 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs)
         s->parent = bdrv_query_stats(bs->file);
     }
 
+    if (bs->backing_hd) {
+        s->has_backing = true;
+        s->backing = bdrv_query_stats(bs->backing_hd);
+    }
+
     return s;
 }
 
qapi-schema.json +6 -4
index f27c48a..0e534d0 100644
@@ -1022,15 +1022,17 @@
 #
 # @stats:  A @BlockDeviceStats for the device.
 #
-# @parent: #optional This may point to the backing block device if this is a
-#          a virtual block device.  If it's a backing block, this will point
-#          to the backing file is one is present.
+# @parent: #optional This describes the file block device if it has one.
+#
+# @backing: #optional This describes the backing block device if it has one.
+#           (Since 2.0)
 #
 # Since: 0.14.0
 ##
 { 'type': 'BlockStats',
   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
-           '*parent': 'BlockStats'} }
+           '*parent': 'BlockStats',
+           '*backing': 'BlockStats'} }
 
 ##
 # @query-blockstats:
Signature · 1 line
1.8.5.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Fam Zheng

Currently there is no way to query BlockStats of the backing chain. This adds "backing" field into BlockStats to make it possible.

The comment of "parent" is reworded.

Quoted 8 lines

---
v2: Only add "backing", drop "file".

---
 block/qapi.c     |  5 +++++
 qapi-schema.json | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Reviewed-by Benoit Canet on v2 1/1
#2 lore raw
In reply to Fam Zheng
Quoted 62 lines · Fam Zheng

Currently there is no way to query BlockStats of the backing chain. This adds "backing" field into BlockStats to make it possible.

The comment of "parent" is reworded.

---
v2: Only add "backing", drop "file".

---
 block/qapi.c     |  5 +++++
 qapi-schema.json | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
block/qapi.c +5 -0
index a32cb79..98b1b83 100644
@@ -318,6 +318,11 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs)
         s->parent = bdrv_query_stats(bs->file);
     }
 
+    if (bs->backing_hd) {
+        s->has_backing = true;
+        s->backing = bdrv_query_stats(bs->backing_hd);
+    }
+
     return s;
 }
 
qapi-schema.json +6 -4
index f27c48a..0e534d0 100644
@@ -1022,15 +1022,17 @@
 #
 # @stats:  A @BlockDeviceStats for the device.
 #
-# @parent: #optional This may point to the backing block device if this is a
-#          a virtual block device.  If it's a backing block, this will point
-#          to the backing file is one is present.
+# @parent: #optional This describes the file block device if it has one.
+#
+# @backing: #optional This describes the backing block device if it has one.
+#           (Since 2.0)
 #
 # Since: 0.14.0
 ##
 { 'type': 'BlockStats',
   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
-           '*parent': 'BlockStats'} }
+           '*parent': 'BlockStats',
+           '*backing': 'BlockStats'} }
 
 ##
 # @query-blockstats:
Signature · 1 line
1.8.5.3
Applied
#3 lore raw
In reply to Fam Zheng

Am 23.01.2014 um 03:03 hat Fam Zheng geschrieben:

Quoted 6 lines

Currently there is no way to query BlockStats of the backing chain. This adds "backing" field into BlockStats to make it possible.

The comment of "parent" is reworded.

Thanks, applied to the block branch.

Kevin