Patchwork [RFC,V6,26/33] qcow2: Add verification of dedup table.

login
register
mail settings
Submitter Benoît Canet
Date Feb. 6, 2013, 12:31 p.m.
Message ID <1360153926-9492-27-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/218634/
State New
Headers show

Comments

Benoît Canet - Feb. 6, 2013, 12:31 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/qcow2-refcount.c |    8 ++++++++
 1 file changed, 8 insertions(+)
Stefan Hajnoczi - Feb. 8, 2013, 10:54 a.m.
On Wed, Feb 06, 2013 at 01:31:59PM +0100, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block/qcow2-refcount.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index f6a80db..d7d9339 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c
> @@ -1154,6 +1154,14 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
>          goto fail;
>      }
>  
> +    if (s->has_dedup) {
> +        ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters,
> +                                 s->dedup_table_offset, s->dedup_table_size, 0);

This doesn't really work because you introduce custom dedup table entry
flags.  It's very dodgy to call check_refcounts_l1() on a table that is
not an L1 table :).

Stefan
Stefan Hajnoczi - Feb. 8, 2013, 11:01 a.m.
On Wed, Feb 06, 2013 at 01:31:59PM +0100, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block/qcow2-refcount.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index f6a80db..d7d9339 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c
> @@ -1154,6 +1154,14 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
>          goto fail;
>      }
>  
> +    if (s->has_dedup) {
> +        ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters,
> +                                 s->dedup_table_offset, s->dedup_table_size, 0);
> +        if (ret < 0) {
> +            goto fail;
> +        }
> +    }

I see patches later on modify the refcount checking functions to handle
dedup tables.  Please adjust the ordering of the patch series so those
patches come first.

Stefan

Patch

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index f6a80db..d7d9339 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1154,6 +1154,14 @@  int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
         goto fail;
     }
 
+    if (s->has_dedup) {
+        ret = check_refcounts_l1(bs, res, refcount_table, nb_clusters,
+                                 s->dedup_table_offset, s->dedup_table_size, 0);
+        if (ret < 0) {
+            goto fail;
+        }
+    }
+
     /* snapshots */
     for(i = 0; i < s->nb_snapshots; i++) {
         sn = s->snapshots + i;