Patchwork [RFC,V2,06/16] qcow2: Collect deduplicated cluster metric.

login
register
mail settings
Submitter Benoît Canet
Date Feb. 6, 2013, 12:32 p.m.
Message ID <1360153939-9563-7-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/218654/
State New
Headers show

Comments

Benoît Canet - Feb. 6, 2013, 12:32 p.m.
---
 block/qcow2-dedup.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
index 708b62c..31988b6 100644
--- a/block/qcow2-dedup.c
+++ b/block/qcow2-dedup.c
@@ -400,10 +400,14 @@  static int qcow2_deduplicate_cluster(BlockDriverState *bs,
     }
 
     /* Increment the refcount of the cluster */
-    return update_refcount(bs,
-                           (hash_node->physical_sect /
-                            s->cluster_sectors) << s->cluster_bits,
-                            1, 1, true);
+    ret = update_refcount(bs,
+                          (hash_node->physical_sect /
+                          s->cluster_sectors) << s->cluster_bits,
+                          1, 1, true);
+
+    s->dedup_metrics.deduplicated_clusters++;
+
+    return ret;
 }
 
 /* This function tries to deduplicate a given cluster.