[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC V8 17/24] qcow2: Drop hash for a given cluster when de
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [RFC V8 17/24] qcow2: Drop hash for a given cluster when dedup makes refcount > 2^16/2. |
Date: |
Thu, 20 Jun 2013 16:26:25 +0200 |
A new physical cluster with the same hash value will be used for further
occurrence of this hash.
Signed-off-by: Benoit Canet <address@hidden>
---
block/qcow2-dedup.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/block/qcow2-dedup.c b/block/qcow2-dedup.c
index 2d2c15c..da4ad5c 100644
--- a/block/qcow2-dedup.c
+++ b/block/qcow2-dedup.c
@@ -305,12 +305,24 @@ static int qcow2_deduplicate_cluster(BlockDriverState *bs,
{
BDRVQcowState *s = bs->opaque;
uint64_t cluster_index = hash_info->physical_sect / s->cluster_sectors;
- int ret = 0;
+ int refcount, ret = 0;
/* Increment the refcount of the cluster */
- ret = qcow2_update_cluster_refcount(bs,
- cluster_index,
- 1);
+ refcount = qcow2_update_cluster_refcount(bs,
+ cluster_index,
+ 1);
+
+ if (refcount < 0) {
+ return refcount;
+ }
+
+ /* if we reached half the max refcount delete the QCowHashInfo from the
+ * store so the next time this cluster will be seen it will be handled as
+ * new
+ */
+ if (refcount >= 0xFFFF/2) {
+ ret = qcow2_store_delete(bs, &s->key_value_store, hash_info);
+ }
if (ret < 0) {
return ret;
--
1.7.10.4
- [Qemu-devel] [RFC V8 07/24] qcow2: Add qcow2_de dup_read_missing_and_concatenate, (continued)
- [Qemu-devel] [RFC V8 07/24] qcow2: Add qcow2_de dup_read_missing_and_concatenate, Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 08/24] qcow2: Create a way to link to l2 tables when deduplicating., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 06/24] qcow2: Add the dedupl ication store., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 05/24] qcow2: Add the hash s tore., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 09/24] qcow2: Make qcow2_update_cluster_refcount public., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 12/24] qcow2: Do allocate on rewrite on the dedup case., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 10/24] qcow2: Add qcow2_dedup and related functions, Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 11/24] qcow2: Add qcow2_dedup_store_new_hashes., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 14/24] qcow2: Load and save deduplication table header extension., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 13/24] qcow2: Implement qcow2_compute_cluster_hash., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 17/24] qcow2: Drop hash for a given cluster when dedup makes refcount > 2^16/2.,
Benoît Canet <=
- [Qemu-devel] [RFC V8 15/24] qcow2: Extract qcow2_set_incompat_feature and qcow2_clear_incompat_feature., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 19/24] qcow2: Integrate deduplication in qcow2_co_writev loop., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 16/24] block: Add qcow2_dedup format and image creation code., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 22/24] qcow2: Add qcow2_dedup_init and qcow2_dedup_close., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 21/24] qcow2: Integrate SKEIN hash algorithm in deduplication., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 23/24] qcow2: Enable the deduplication feature., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 24/24] qcow2: Enable deduplication tests, Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 18/24] qcow2: Remove hash when cluster is deleted., Benoît Canet, 2013/06/20
- [Qemu-devel] [RFC V8 20/24] qcow2: Serialize write requests when deduplication is activated., Benoît Canet, 2013/06/20