Skip to contentSkip to conversation

spec/qcow2: bitmaps: zero bitmap table offset

PATCH Superseded Vladimir Sementsov-Ogievskiy 3 participants 4 messages Jun 29, 2016 – Jun 30, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spec/qcow2: bitmaps: zero bitmap table offset

This allows effectively free in_use bitmap clusters including bitmap table without loss of meaningful data.

Now it is possible only to free end-point clusters and zero-out (not free) bitmap table

---

Hi all!

Here is one small but significant addition to specification of bitmaps in qcow2.

Can we apply it just like this or I'll have to inroduce new incompatible feature flag?

If there is existing implementation of the format, it may break image, saved by software, using extended spec. But is there are any implementations except not finished my one?

 docs/specs/qcow2.txt | 2 ++
 1 file changed, 2 insertions(+)
docs/specs/qcow2.txt +2 -0
index 80cdfd0..dd07a82 100644
@@ -435,6 +435,8 @@ Structure of a bitmap directory entry:
                     Offset into the image file at which the bitmap table
                     (described below) for the bitmap starts. Must be aligned to
                     a cluster boundary.
+                    Zero value means that bitmap table is not allocated and the
+                    bitmap should be considered as empty (all bits are zero).
 
          8 - 11:    bitmap_table_size
                     Number of entries in the bitmap table of the bitmap.
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 28 lines · Vladimir Sementsov-Ogievskiy

This allows effectively free in_use bitmap clusters including bitmap table without loss of meaningful data.

Now it is possible only to free end-point clusters and zero-out (not free) bitmap table

---

Hi all!

Here is one small but significant addition to specification of bitmaps in qcow2.

Can we apply it just like this or I'll have to inroduce new incompatible feature flag?

If there is existing implementation of the format, it may break image, saved by software, using extended spec. But is there are any implementations except not finished my one?

  docs/specs/qcow2.txt | 2 ++
  1 file changed, 2 insertions(+)
docs/specs/qcow2.txt +0 -0
index 80cdfd0..dd07a82 100644

docs/specs/qcow2.txt Structure of a bitmap directory entry: · line 442

Quoted 8 lines
docs/specs/qcow2.txt +2 -0
@@ -435,6 +435,8 @@ Structure of a bitmap directory entry:
                      Offset into the image file at which the bitmap table
                      (described below) for the bitmap starts. Must be aligned to
                      a cluster boundary.
+                    Zero value means that bitmap table is not allocated and the
+                    bitmap should be considered as empty (all bits are zero).
 
           8 - 11:    bitmap_table_size
                      Number of entries in the bitmap table of the bitmap.

+ bitmap_table_size must be zero if bitmap_table_size is zero.

Signature · 2 lines
Best regards,
Vladimir
#2 lore raw
Quoted 3 lines · Vladimir Sementsov-Ogievskiy
Quoted 2 lines · Vladimir Sementsov-Ogievskiy

This allows effectively free in_use bitmap clusters including bitmap table without loss of meaningful data.

I'm afraid I fail to understand this sentence.

Quoted 3 lines
Quoted 3 lines

Now it is possible only to free end-point clusters and zero-out (not free) bitmap table

OK, so the idea is not having to store a bitmap table if the bitmap is fully zeroed?

Quoted 11 lines
Quoted 11 lines

---

Hi all!

Here is one small but significant addition to specification of bitmaps in qcow2.

Can we apply it just like this or I'll have to inroduce new incompatible feature flag?

I think it should be fine without a flag.

Quoted 23 lines
Quoted 23 lines

If there is existing implementation of the format, it may break image, saved by
software, using extended spec. But is there are any implementations except not
finished my one?

  docs/specs/qcow2.txt | 2 ++
  1 file changed, 2 insertions(+)
docs/specs/qcow2.txt +0 -0
index 80cdfd0..dd07a82 100644
@@ -435,6 +435,8 @@ Structure of a bitmap directory entry:
                      Offset into the image file at which the bitmap

table
(described below) for the bitmap starts. Must be
aligned to
a cluster boundary.
+ Zero value means that bitmap table is not
allocated and the

Quoted 8 lines
Quoted 5 lines

+ bitmap should be considered as empty (all bits
are zero).
8 - 11: bitmap_table_size
Number of entries in the bitmap table of the
bitmap.

+ bitmap_table_size must be zero if bitmap_table_size is
zero.

The second bitmap_table_size should probably be bitmap_table_offset.

The idea looks good to me, but I'd rather understand the commit message before giving an R-b. :-)

Max

#3 lore raw
In reply to Vladimir Sementsov-Ogievskiy
Quoted 6 lines · Vladimir Sementsov-Ogievskiy

This allows effectively free in_use bitmap clusters including bitmap table without loss of meaningful data.

Now it is possible only to free end-point clusters and zero-out (not free) bitmap table

Same comment as Max, the commit message needs to be a little better.

Quoted 5 lines

---

Hi all!

Quoted 8 lines

Here is one small but significant addition to specification of bitmaps in qcow2.

Can we apply it just like this or I'll have to inroduce new incompatible feature flag?

If there is existing implementation of the format, it may break image, saved by software, using extended spec. But is there are any implementations except not finished my one?

In pure, actual fact... your WIP reference implementation is almost certainly the only implementation in existence.

I think this change is probably fine, as a zeroed entry here before would have meant literally the qcow2 header itself which is quite obviously wrong/invalid.

So it's probably a fairly easy extension to identify dynamically/on-the-fly and won't collide with prior versions.

Quoted 18 lines
 docs/specs/qcow2.txt | 2 ++
 1 file changed, 2 insertions(+)
docs/specs/qcow2.txt +2 -0
index 80cdfd0..dd07a82 100644
@@ -435,6 +435,8 @@ Structure of a bitmap directory entry:
                     Offset into the image file at which the bitmap table
                     (described below) for the bitmap starts. Must be aligned to
                     a cluster boundary.
+                    Zero value means that bitmap table is not allocated and the
+                    bitmap should be considered as empty (all bits are zero).
 
          8 - 11:    bitmap_table_size
                     Number of entries in the bitmap table of the bitmap.