[RFC,V4,15/30] qcow2: Add qcow2_dedup_init and qcow2_dedup_close.

Submitted by Benoît Canet on Jan. 2, 2013, 4:16 p.m.

Details

Message ID 1357143393-29832-16-git-send-email-benoit@irqsave.net
State New
Headers show

Commit Message

Benoît Canet Jan. 2, 2013, 4:16 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/qcow2-dedup.c |   16 ++++++++++++++++
 block/qcow2.h       |    2 ++
 2 files changed, 18 insertions(+)

Patch hide | download patch | download mbox

diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
index 4c391e5..12a2dad 100644
--- a/block/qcow2-dedup.c
+++ b/block/qcow2-dedup.c
@@ -986,3 +986,19 @@  void coroutine_fn qcow2_co_load_dedup_hashes(void *opaque)
         qemu_co_mutex_unlock(&s->lock);
     }
 }
+
+int qcow2_dedup_init(BlockDriverState *bs)
+{
+    BDRVQcowState *s = bs->opaque;
+    return qcow2_do_table_init(bs,
+                               &s->dedup_table,
+                               s->dedup_table_offset,
+                               s->dedup_table_size,
+                               false);
+}
+
+void qcow2_dedup_close(BlockDriverState *bs)
+{
+    BDRVQcowState *s = bs->opaque;
+    g_free(s->dedup_table);
+}
diff --git a/block/qcow2.h b/block/qcow2.h
index 4932750..43586f2 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -474,5 +474,7 @@  int qcow2_dedup_store_new_hashes(BlockDriverState *bs,
                                  uint64_t logical_sect,
                                  uint64_t physical_sect);
 void coroutine_fn qcow2_co_load_dedup_hashes(void *opaque);
+int qcow2_dedup_init(BlockDriverState *bs);
+void qcow2_dedup_close(BlockDriverState *bs);
 
 #endif