[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qcow2: Patch for shrinking qcow2 disk image
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH] qcow2: Patch for shrinking qcow2 disk image |
Date: |
Fri, 4 Apr 2014 08:51:37 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, 04/03 07:28, Jun Lee wrote:
> > @@ -66,7 +63,18 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t
> > min_size,
> >
> > new_l1_size2 = sizeof(uint64_t) * new_l1_size;
> > new_l1_table = g_malloc0(align_offset(new_l1_size2, 512));
> > - memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t));
> > +
> > + /* shrinking the image */
> > + if (min_size <= s->l1_size) {
> > + if (s->l1_table[new_l1_size] != 0) {
>
> Is this safe as advertised? Do we need to scan all the dropped l1 entries,
> instead of only the first one?
> -As the dropped l1 entries will not contain any value data.
I don't understand, how do you make sure of that without checking it?
Fam