Patchwork [RFC,V7,22/32] qcow2: Add qcow2_dedup_is_running to probe if dedup is running.

login
register
mail settings
Submitter Benoît Canet
Date March 15, 2013, 2:49 p.m.
Message ID <1363358986-8360-23-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/228031/
State New
Headers show

Comments

Benoît Canet - March 15, 2013, 2:49 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/qcow2-dedup.c |    6 ++++++
 block/qcow2.h       |    1 +
 2 files changed, 7 insertions(+)

Patch

diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
index 68a09ff..cd47e2c 100644
--- a/block/qcow2-dedup.c
+++ b/block/qcow2-dedup.c
@@ -1070,3 +1070,9 @@  void qcow2_dedup_destroy_hash(BlockDriverState *bs,
     /* remove from ram if present so we won't dedup with it anymore */
     qcow2_remove_hash_node_by_sector(bs, physical_sect);
 }
+
+bool qcow2_dedup_is_running(BlockDriverState *bs)
+{
+    BDRVQcowState *s = bs->opaque;
+    return s->has_dedup && s->dedup_status == DEDUP_STATUS_STARTED;
+}
diff --git a/block/qcow2.h b/block/qcow2.h
index c1c0978..b858db9 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -498,5 +498,6 @@  int qcow2_dedup_store_new_hashes(BlockDriverState *bs,
                                  uint64_t physical_sect);
 void qcow2_dedup_destroy_hash(BlockDriverState *bs,
                               uint64_t cluster_index);
+bool qcow2_dedup_is_running(BlockDriverState *bs);
 
 #endif