Patchwork [RFC,V1,08/12] qcow2: Add qcow2_resume_dedup.

login
register
mail settings
Submitter Benoît Canet
Date Jan. 16, 2013, 4:25 p.m.
Message ID <1358353518-5421-9-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/212838/
State New
Headers show

Comments

Benoît Canet - Jan. 16, 2013, 4:25 p.m.
---
 block/qcow2-dedup.c |   14 ++++++++++++++
 block/qcow2.c       |    1 +
 block/qcow2.h       |    1 +
 3 files changed, 16 insertions(+)

Patch

diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
index e007387..93545af 100644
--- a/block/qcow2-dedup.c
+++ b/block/qcow2-dedup.c
@@ -1469,3 +1469,17 @@  void qcow2_pause_dedup(BlockDriverState *bs)
     qcow2_dedup_reset(bs);
     s->dedup_status = QCOW_DEDUP_STOPPED;
 }
+
+void qcow2_resume_dedup(BlockDriverState *bs)
+{
+    BDRVQcowState *s = bs->opaque;
+
+    if (s->dedup_status != QCOW_DEDUP_STOPPED) {
+        return;
+    }
+
+    s->dedup_status = QCOW_DEDUP_STARTING;
+
+    s->dedup_resume_co = qemu_coroutine_create(qcow2_co_dedup_resume);
+    qemu_coroutine_enter(s->dedup_resume_co, bs);
+}
diff --git a/block/qcow2.c b/block/qcow2.c
index c17ab63..d5681ad 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2012,6 +2012,7 @@  static BlockDriver bdrv_qcow2 = {
     .bdrv_invalidate_cache      = qcow2_invalidate_cache,
 
     .bdrv_pause_dedup           = qcow2_pause_dedup,
+    .bdrv_resume_dedup           = qcow2_resume_dedup,
 
     .create_options = qcow2_create_options,
     .bdrv_check = qcow2_check,
diff --git a/block/qcow2.h b/block/qcow2.h
index 5940c89..2b5a7d4 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -512,5 +512,6 @@  int qcow2_dedup_init(BlockDriverState *bs);
 void qcow2_dedup_close(BlockDriverState *bs);
 void qcow2_dedup_update_metrics(BlockDriverState *bs);
 void qcow2_pause_dedup(BlockDriverState *bs);
+void qcow2_resume_dedup(BlockDriverState *bs);
 
 #endif