[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V2 16/16] qapi: Return virtual block device deduplicat
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [RFC V2 16/16] qapi: Return virtual block device deduplication metrics in QMP |
Date: |
Wed, 6 Feb 2013 13:32:19 +0100 |
---
block.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/block.c b/block.c
index 50dab8e..fec29f4 100644
--- a/block.c
+++ b/block.c
@@ -2889,6 +2889,40 @@ BlockInfoList *qmp_query_block(Error **errp)
return head;
}
+static void bdrv_get_dedup_metrics(const BlockDriverState *bs,
+ BlockDeviceStats *stats)
+{
+ BlockDriverInfo bdi;
+
+ if (bdrv_get_info((BlockDriverState *) bs, &bdi) < 0) {
+ return;
+ }
+
+ if (!bdi.has_dedup) {
+ return;
+ }
+
+ stats->has_deduplication = true;
+ stats->deduplication = g_malloc0(sizeof(*stats->deduplication));
+ stats->deduplication->deduplicated_clusters =
+ bdi.dedup_metrics.deduplicated_clusters;
+ stats->deduplication->non_deduplicated_clusters =
+ bdi.dedup_metrics.non_deduplicated_clusters;
+ stats->deduplication->missing_data_reads =
+ bdi.dedup_metrics.missing_data_reads;
+ stats->deduplication->ram_hash_creations =
+ bdi.dedup_metrics.ram_hash_creations;
+ stats->deduplication->ram_hash_deletions =
+ bdi.dedup_metrics.ram_hash_deletions;
+ stats->deduplication->ram_usage =
+ bdi.dedup_metrics.ram_usage;
+ stats->deduplication->deleted_clusters =
+ bdi.dedup_metrics.deleted_clusters;
+ stats->deduplication->refcount_overflows =
+ bdi.dedup_metrics.refcount_overflows;
+ stats->deduplication->status = bdi.dedup_status;
+}
+
BlockStats *bdrv_query_stats(const BlockDriverState *bs)
{
BlockStats *s;
@@ -2911,6 +2945,8 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs)
s->stats->rd_total_time_ns = bs->total_time_ns[BDRV_ACCT_READ];
s->stats->flush_total_time_ns = bs->total_time_ns[BDRV_ACCT_FLUSH];
+ bdrv_get_dedup_metrics(bs, s->stats);
+
if (bs->file) {
s->has_parent = true;
s->parent = bdrv_query_stats(bs->file);
--
1.7.10.4
- [Qemu-devel] [RFC V2 14/16] qcow2: Add qcow2_dedup_update_metrics to compute dedup RAM usage., (continued)
- [Qemu-devel] [RFC V2 14/16] qcow2: Add qcow2_dedup_update_metrics to compute dedup RAM usage., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 15/16] qcow2: returns deduplication metrics and status via bdrv_get_info(), Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 10/16] qcow2: Count cluster deleted metric, Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 11/16] qcow2: Count deduplication refcount overflow metric., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 07/16] qcow2: Collect undeduplicated cluster metric., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 02/16] qcow2: Enable the deduplication feature., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 04/16] qcow2: Initialize deduplication metrics., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 08/16] qcow2: Count QCowHashNode creation metrics., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 09/16] qcow2: Count QCowHashNode removal from tree for metrics., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 16/16] qapi: Return virtual block device deduplication metrics in QMP,
Benoît Canet <=
- [Qemu-devel] [RFC V2 12/16] qapi: Add support for deduplication infos in qapi-schema.json., Benoît Canet, 2013/02/06
- [Qemu-devel] [RFC V2 13/16] block: Add deduplication metrics to BlockDriverInfo., Benoît Canet, 2013/02/06