Patchwork [RFC,V3,13/24] qcow2: Add qcow2_dedup_init and qcow2_dedup_close.

login
register
mail settings
Submitter Benoît Canet
Date Nov. 26, 2012, 1:05 p.m.
Message ID <1353935123-24199-14-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/201686/
State New
Headers show

Comments

Benoît Canet - Nov. 26, 2012, 1:05 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

diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
index 1760e8a..80e9477 100644
--- a/block/qcow2-dedup.c
+++ b/block/qcow2-dedup.c
@@ -793,3 +793,19 @@  int qcow2_dedup_grow_table(BlockDriverState *bs,
                                qcow2_dedup_save_table_info,
                                "dedup");
 }
+
+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 af80d16..87a7f43 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -405,5 +405,7 @@  void coroutine_fn qcow2_co_load_dedup_hashes(void *opaque);
 int qcow2_dedup_grow_table(BlockDriverState *bs,
                            int min_size,
                            bool exact_size);
+int qcow2_dedup_init(BlockDriverState *bs);
+void qcow2_dedup_close(BlockDriverState *bs);
 
 #endif