@@ -1311,3 +1311,16 @@ void qcow2_dedup_close(BlockDriverState *bs)
{
qcow2_dedup_free(bs);
}
+
+#define GTREE_NODE_SIZE sizeof(int) * 5
+
+void qcow2_dedup_update_metrics(BlockDriverState *bs)
+{
+ BDRVQcowState *s = bs->opaque;
+
+ uint64_t nb_hashs = s->dedup_metrics.ram_hash_creations -
+ s->dedup_metrics.ram_hash_deletions;
+
+ s->dedup_metrics.ram_usage = nb_hashs * GTREE_NODE_SIZE * 2;
+ s->dedup_metrics.ram_usage += nb_hashs * sizeof(QCowHashNode);
+}
@@ -510,5 +510,6 @@ void qcow2_dedup_refcount_half_max_reached(BlockDriverState *bs,
bool qcow2_dedup_is_running(BlockDriverState *bs);
int qcow2_dedup_init(BlockDriverState *bs);
void qcow2_dedup_close(BlockDriverState *bs);
+void qcow2_dedup_update_metrics(BlockDriverState *bs);
#endif